package com.css.fxfzfxqh.modules.vulnerabilityData.service.impl;

import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import cn.hutool.core.io.FileUtil;
import com.css.fxfzfxqh.base.attachment.entity.AttachmentInfoEntity;
import com.css.fxfzfxqh.base.attachment.service.AttachmentInfoService;
import com.css.fxfzfxqh.base.dict.repository.entity.DictItemEntity;
import com.css.fxfzfxqh.base.dict.service.DictService;
import com.css.fxfzfxqh.constants.PgaConstants;
import com.css.fxfzfxqh.constants.YNEnum;
import com.css.fxfzfxqh.modules.vulnerabilityData.cztDataMange.entity.RdInformationEntity;
import com.css.fxfzfxqh.modules.vulnerabilityData.cztDataMange.exception.ShpFieldException;
import com.css.fxfzfxqh.modules.vulnerabilityData.cztDataMange.repository.DomeFacilitiesRepository;
import com.css.fxfzfxqh.modules.vulnerabilityData.entity.*;
import com.css.fxfzfxqh.modules.vulnerabilityData.repository.VulnerabilityRepository;
import com.css.fxfzfxqh.modules.vulnerabilityData.service.VulnerabilityService;
import com.css.fxfzfxqh.modules.vulnerabilityData.verify.VulnerabilityExcelVerify;
import com.css.fxfzfxqh.modules.vulnerabilityData.vo.MatrixConvertCurveVo;
import com.css.fxfzfxqh.modules.vulnerabilityData.vo.QueryParamsVo;
import com.css.fxfzfxqh.modules.vulnerabilityData.vo.VulnerabilityImportVo;
import com.css.fxfzfxqh.util.*;
import com.css.fxfzfxqh.web.PlatformSessionContext;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotNull;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;


@Service
@Slf4j
public class VulnerabilityServiceImpl implements VulnerabilityService {

    @Autowired
    private AttachmentInfoService attachmentInfoService;
    @Autowired
    private DictService dictService;
    @Autowired
    private DomeFacilitiesRepository domeFacilitiesRepository;



    @Value("${image.localDir}")
    private String localDir;

    @Autowired
    VulnerabilityRepository vulnerabilityRepository;


    @Autowired
    private VulnerabilityExcelVerify vulnerabilityExcelVerify;

    @Autowired
    private RedisTemplate redisTemplate;

    // 易损性数据编号流水号redis key
    public static final String YSXSJ_CODE_SERIAL_NUMBER_KEY = "fxqh:vulnerability:vulnerability_code:serial_number";

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Map<String, Object> uploadExcel(MultipartFile file, String attachId, String type, String province, String city,String county) {
        //type 1:地下管网   2:水厂泵房  3:水厂水池  4:燃气-储气罐    5:桥梁    6:道路    7:变电站
        // 8:架空线路  9:电缆线路  10:发电厂  11:通信室内设备   12:电视塔    13:重大工程   14:水库大坝
        Map<String, Object> map = new HashMap<>();
        if(type.equals("1")){
            map = uploadDxPipeNetworkExcel(file,attachId,province, city, county);
        }else if(type.equals("2")){
            map = uploadWaterworksExcel(file,attachId,province, city, county);
        }else if(type.equals("3")){
            map = uploadPoolExcel(file,attachId,province, city, county);
        }else if(type.equals("4")){
            map = uploadAirReceiverExcel(file,attachId,province, city, county);
        }else if(type.equals("5")){
            map = uploadBridgeExcel(file,attachId,province, city, county);
        }else if(type.equals("6")){
            map = uploadRoadExcel(file,attachId,province, city, county);
        }else if(type.equals("7")){
            map = uploadTransformerSubstationExcel(file,attachId,province, city, county);
        }else if(type.equals("8")){
            map = uploadOverheadLineExcel(file,attachId,province, city, county);
        }else if(type.equals("9")){
            map = uploadCableRouteExcel(file,attachId,province, city, county);
        }else if(type.equals("10")){
            map = uploadImportantPowerhouseExcel(file,attachId,province, city, county);
        }else if(type.equals("11")){
            map = uploadCommIndoorEquipmentExcel(file,attachId,province, city, county);
        }else if(type.equals("12")){
            map = uploadTvTowerExcel(file,attachId,province, city, county);
        }else if(type.equals("13")){
            map = uploadMajorProjectExcel(file,attachId,province, city, county);
        }else if(type.equals("14")){
            map = uploadReserviorExcel(file,attachId,province, city, county);
        }else if(type.equals("15")){

        }
        return map;
    }

    private Map<String, Object> uploadReserviorExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        /*params.setImportFields(new String[]{"序号","水坝名称","水坝地点","经度","纬度","库容（立方米）","建造年代","坝长（米）","坝高（米）","顶宽（米）","结构类型","水坝类型","设防烈度","位置","场地","填料","坝基","维护现状","省","市","县"});
         */params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<RdInformationEntity> result = ExcelImportUtil.importExcelMore(inputStream, RdInformationEntity.class, params);
            List<RdInformationEntity> resultData = result.getList();
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<RdInformationEntity> list = new ArrayList<>();
                for (RdInformationEntity rdInformationEntity : resultData) {

                    String uuid = UUIDGenerator.getUUID();
                    rdInformationEntity.setCrId(uuid);
                    rdInformationEntity.setCreateUser(userId);
                    rdInformationEntity.setCreateTime(new Date());
                    rdInformationEntity.setDelFlag("0");
                    rdInformationEntity.setAttachId(attachId);
                    rdInformationEntity.setStructureType(getKeyByValue("smxskdbjglx",rdInformationEntity.getStructureType()));
                    rdInformationEntity.setType(getKeyByValue("smxskdbsblx",rdInformationEntity.getType()));
                    rdInformationEntity.setSpace(getKeyByValue("smxskdbcd",rdInformationEntity.getSpace()));
                    rdInformationEntity.setFilling(getKeyByValue("smxskdbtl",rdInformationEntity.getFilling()));
                    rdInformationEntity.setDamFoundation(getKeyByValue("smxskdbbj",rdInformationEntity.getDamFoundation()));
                    rdInformationEntity.setMaintenanceStatus(getKeyByValue("smxskdbwhxz",rdInformationEntity.getMaintenanceStatus()));

                    String longitude = rdInformationEntity.getLongitude();
                    String latitude = rdInformationEntity.getLatitude();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    rdInformationEntity.setGeom(geom);
                    list.add(rdInformationEntity);
                }
                for(RdInformationEntity rdInformationEntity : list){
                    res=domeFacilitiesRepository.saveRdInformation(rdInformationEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);
                }

            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    private Map<String, Object> uploadMajorProjectExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        //params.setImportFields(new String[]{"序号","地震名称","发生时间","震级","重大工程类别","设防情况","年代","地震动参数（烈度）","破坏状态","省","市","区/县"});
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<MajorProjectEntity> result = ExcelImportUtil.importExcelMore(inputStream, MajorProjectEntity.class, params);
            List<MajorProjectEntity> resultData = result.getList();
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<MajorProjectEntity> list = new ArrayList<>();
                for (MajorProjectEntity majorProjectEntity : resultData) {

                    String uuid = UUIDGenerator.getUUID();
                    majorProjectEntity.setCmpId(uuid);
                    majorProjectEntity.setCreateUser(userId);
                    majorProjectEntity.setCreateTime(new Date());
                    majorProjectEntity.setDelFlag("0");
                    majorProjectEntity.setAttachId(attachId);
                    list.add(majorProjectEntity);
                }
                for(MajorProjectEntity majorProjectEntity : list){
                    res = vulnerabilityRepository.saveMajorProject(majorProjectEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    private String getValueByKey(String code,String key){
        if (!PlatformObjectUtils.isEmpty(key)) {
            String value = dictService.getValueByDictCodeAndKey(code, key.trim());
            return value;
        }
        return null;
    }

    private String getKeyByValue(String code,String value){
        if (!PlatformObjectUtils.isEmpty(value)) {
            String key = dictService.getKeyByDictCodeAndValue(code,value.trim());
            return key;
        }
        return null;
    }

    //电视塔excel
    private Map<String, Object> uploadTvTowerExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setImportFields(new String[]{"电视塔名称","地址位置","地理经度坐标","地理纬度坐标","结构类型","建筑面积","建造年代","总高度","塔楼处标高","建筑物场址","设防标准","场地类型","现状评价","重建单位面积造价","天线处标高","基本周期","塔柱结构类型","塔座结构类型","塔座层数","塔座高度","省","市","区/县"});
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<TvTowerEntity> result = ExcelImportUtil.importExcelMore(inputStream, TvTowerEntity.class, params);
            List<TvTowerEntity> resultData = result.getList();
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<TvTowerEntity> list = new ArrayList<>();
                for (TvTowerEntity tvTowerEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    tvTowerEntity.setCttId(uuid);
                    tvTowerEntity.setCreateUser(userId);
                    tvTowerEntity.setCreateTime(new Date());
                    tvTowerEntity.setDelFlag("0");
                    tvTowerEntity.setAttachId(attachId);
                    String longitude = tvTowerEntity.getObjectLon();
                    String latitude = tvTowerEntity.getObjectLat();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    tvTowerEntity.setGeom(geom);
                    list.add(tvTowerEntity);
                }
                for(TvTowerEntity tvTowerEntity : list){
                    res = vulnerabilityRepository.saveTvTower(tvTowerEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //通信室内设备
    private Map<String, Object> uploadCommIndoorEquipmentExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setImportFields(new String[]{"所属建筑物名称","所属建筑物地址位置","所属建筑物地理经度坐标","所属建筑物地理纬度坐标","设备类别","设备名称","型号","所在楼层","设备固定形式","底部螺栓直径","重新购置的造价","厂家","尺寸","重量","省","市","区/县"});
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<CommIndoorEquipmentEntity> result = ExcelImportUtil.importExcelMore(inputStream, CommIndoorEquipmentEntity.class, params);
            List<CommIndoorEquipmentEntity> resultData = result.getList();
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<CommIndoorEquipmentEntity> list = new ArrayList<>();
                for (CommIndoorEquipmentEntity commIndoorEquipment : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    commIndoorEquipment.setCcieId(uuid);
                    commIndoorEquipment.setCreateUser(userId);
                    commIndoorEquipment.setCreateTime(new Date());
                    commIndoorEquipment.setDelFlag("0");
                    commIndoorEquipment.setAttachId(attachId);
                    String longitude = commIndoorEquipment.getObjectLon();
                    String latitude = commIndoorEquipment.getObjectLat();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    commIndoorEquipment.setGeom(geom);
                    list.add(commIndoorEquipment);
                }
                for(CommIndoorEquipmentEntity commIndoorEquipment : list){
                    res = vulnerabilityRepository.saveCommIndoorEquipment(commIndoorEquipment);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //重要发电厂房excel
    private Map<String, Object> uploadImportantPowerhouseExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setImportFields(new String[]{"电厂编码","电厂名称","位置","经度","纬度","建设年份","设防烈度","装机容量","发电类型","发电厂总造价","变电设备造价","发电设备总造价","钢结构类建构筑物面积","钢结构类建构筑物单价","钢筋混凝土类建构筑物面积","钢筋混凝土类建构筑物单价","砖混结构类建构筑物面积","砖混结构类建构筑物单价"});
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<ImportantPowerhouseEntity> result = ExcelImportUtil.importExcelMore(inputStream, ImportantPowerhouseEntity.class, params);
            List<ImportantPowerhouseEntity> resultData = result.getList();
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<ImportantPowerhouseEntity> list = new ArrayList<>();
                for (ImportantPowerhouseEntity importantPowerhouseEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    importantPowerhouseEntity.setCipId(uuid);
                    importantPowerhouseEntity.setCreateUser(userId);
                    importantPowerhouseEntity.setCreateTime(new Date());
                    importantPowerhouseEntity.setDelFlag("0");
                    importantPowerhouseEntity.setAttachId(attachId);
                    importantPowerhouseEntity.setGeneratingType(getKeyByValue("smxfdcffdlx",importantPowerhouseEntity.getGeneratingType()));
                    importantPowerhouseEntity.setFortificationIntensity(getKeyByValue("smxsfld",importantPowerhouseEntity.getFortificationIntensity()));
                    String longitude = importantPowerhouseEntity.getLongitude();
                    String latitude = importantPowerhouseEntity.getLatitude();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    importantPowerhouseEntity.setGeom(geom);
                    list.add(importantPowerhouseEntity);
                }
                for(ImportantPowerhouseEntity importantPowerhouseEntity : list){
                    res = vulnerabilityRepository.saveImportantPowerhouse(importantPowerhouseEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //电缆线路excel
    private Map<String, Object> uploadCableRouteExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setHeadRows(2);
        //params.setImportFields(new String[]{"变电站编码","变电站名称","变电站位置","经度","纬度","变电站类型","变电站电压等级","主控室房屋结构类型","设防烈度","变电站总造价","室外高压电气设备总造价","室内设备总造价","房屋建筑总造价","建设年代","场地类别","省","市","区/县"});
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<CableRouteEntity> result = ExcelImportUtil.importExcelMore(inputStream, CableRouteEntity.class, params);
            List<CableRouteEntity> resultData = result.getList();
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<CableRouteEntity> list = new ArrayList<>();
                for (CableRouteEntity cableRouteEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    cableRouteEntity.setCcrId(uuid);
                    cableRouteEntity.setCreateUser(userId);
                    cableRouteEntity.setCreateTime(new Date());
                    cableRouteEntity.setDelFlag("0");
                    cableRouteEntity.setAttachId(attachId);
                    cableRouteEntity.setFortificationIntensity(getKeyByValue("smxsfld",cableRouteEntity.getFortificationIntensity()));
                    /*String longitude = cableRouteEntity.getLongitude();
                    String latitude = cableRouteEntity.getLatitude();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    cableRouteEntity.setGeom(geom);*/
                    list.add(cableRouteEntity);
                }
                for(CableRouteEntity cableRouteEntity : list){
                    res = vulnerabilityRepository.saveCableRoute(cableRouteEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //架空线路excel
    private Map<String, Object> uploadOverheadLineExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setHeadRows(2);
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<OverheadLineEntity> result = ExcelImportUtil.importExcelMore(inputStream, OverheadLineEntity.class, params);
            List<OverheadLineEntity> resultData = result.getList();
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<OverheadLineEntity> list = new ArrayList<>();
                for (OverheadLineEntity overheadLineEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    overheadLineEntity.setColId(uuid);
                    overheadLineEntity.setFortificationIntensity(getKeyByValue("smxsfld",overheadLineEntity.getFortificationIntensity()));
                    overheadLineEntity.setLandform35(getKeyByValue("smxbdzdxdm",overheadLineEntity.getLandform35()));//地形地貌
                    overheadLineEntity.setType35(getKeyByValue("smxbdztglx",overheadLineEntity.getType35()));//杆塔类型
                    overheadLineEntity.setLandform66(getKeyByValue("smxbdzdxdm",overheadLineEntity.getLandform66()));
                    overheadLineEntity.setType66(getKeyByValue("smxbdztglx",overheadLineEntity.getType66()));
                    overheadLineEntity.setLandform110(getKeyByValue("smxbdzdxdm",overheadLineEntity.getLandform110()));
                    overheadLineEntity.setType110(getKeyByValue("smxbdztglx",overheadLineEntity.getType110()));
                    overheadLineEntity.setLandform220(getKeyByValue("smxbdzdxdm",overheadLineEntity.getLandform220()));
                    overheadLineEntity.setType220(getKeyByValue("smxbdztglx",overheadLineEntity.getType220()));
                    overheadLineEntity.setLandform330(getKeyByValue("smxbdzdxdm",overheadLineEntity.getLandform330()));
                    overheadLineEntity.setType330(getKeyByValue("smxbdztglx",overheadLineEntity.getType330()));
                    overheadLineEntity.setLandform500(getKeyByValue("smxbdzdxdm",overheadLineEntity.getLandform500()));
                    overheadLineEntity.setType500(getKeyByValue("smxbdztglx",overheadLineEntity.getType500()));
                    overheadLineEntity.setCreateUser(userId);
                    overheadLineEntity.setCreateTime(new Date());
                    overheadLineEntity.setDelFlag("0");
                    overheadLineEntity.setAttachId(attachId);
                    list.add(overheadLineEntity);
                }
                for(OverheadLineEntity overheadLineEntity : list){
                    res = vulnerabilityRepository.saveOverheadLine(overheadLineEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //生命线变电站excel
    private Map<String, Object> uploadTransformerSubstationExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setImportFields(new String[]{"变电站编码","变电站名称","变电站位置","经度","纬度","变电站类型","变电站电压等级","主控室房屋结构类型","设防烈度","变电站总造价","室外高压电气设备总造价","室内设备总造价","房屋建筑总造价","建设年代","场地类别","省","市","区/县"});
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<TransformerSubstationEntity> result = ExcelImportUtil.importExcelMore(inputStream, TransformerSubstationEntity.class, params);
            List<TransformerSubstationEntity> resultData = result.getList();
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<TransformerSubstationEntity> list = new ArrayList<>();
                for (TransformerSubstationEntity transformerSubstationEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    transformerSubstationEntity.setCtsId(uuid);
                    transformerSubstationEntity.setStructureType(getKeyByValue("smxbdzzkfwjglx",transformerSubstationEntity.getStructureType()));
                    transformerSubstationEntity.setFortificationIntensity(getKeyByValue("smxsfld",transformerSubstationEntity.getFortificationIntensity()));
                    transformerSubstationEntity.setSite(getKeyByValue("smxcdlb",transformerSubstationEntity.getSite()));
                    transformerSubstationEntity.setCreateUser(userId);
                    transformerSubstationEntity.setCreateTime(new Date());
                    transformerSubstationEntity.setDelFlag("0");
                    transformerSubstationEntity.setAttachId(attachId);
                    String longitude = transformerSubstationEntity.getLongitude();
                    String latitude = transformerSubstationEntity.getLatitude();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    transformerSubstationEntity.setGeom(geom);
                    list.add(transformerSubstationEntity);
                }
                for(TransformerSubstationEntity transformerSubstationEntity : list){
                    res = vulnerabilityRepository.saveTransformerSubstation(transformerSubstationEntity);

                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //生命线-道路excel
    private Map<String, Object> uploadRoadExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setImportFields(new String[]{"编码","道路名称","道路等级","区间","路基土","场地类别","设防情况","地基失效","路基类型","路基高差","最大载重量","路面类型","总里程","宽度","简介","省","市","区/县"});
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<RoadEntity> result = ExcelImportUtil.importExcelMore(inputStream, RoadEntity.class, params);
            List<RoadEntity> resultData = result.getList();
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<RoadEntity> list = new ArrayList<>();
                for (RoadEntity roadEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    roadEntity.setCrId(uuid);
                    roadEntity.setCreateUser(userId);
                    roadEntity.setCreateTime(new Date());
                    roadEntity.setDelFlag("0");
                    roadEntity.setAttachId(attachId);
                    roadEntity.setCrClass(getKeyByValue("smxdldj",roadEntity.getCrClass()));
                    roadEntity.setRoadbedSoil(getKeyByValue("smxdlljt",roadEntity.getRoadbedSoil()));
                    roadEntity.setSiteSoil(getKeyByValue("smxcdlb",roadEntity.getSiteSoil()));
                    roadEntity.setFortification(getKeyByValue("smxdlsfqk",roadEntity.getFortification()));
                    roadEntity.setFoundationFail(getKeyByValue("smxdldjsx",roadEntity.getFoundationFail()));
                    roadEntity.setRoadbedType(getKeyByValue("smxdlljlx",roadEntity.getRoadbedType()));
                    roadEntity.setPavement(getKeyByValue("smxdllmlx",roadEntity.getPavement()));
                   /* String longitude = roadEntity.getLongitude();
                    String latitude = roadEntity.getLatitude();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    roadEntity.setGeom(geom);*/
                    list.add(roadEntity);
                }
                for(RoadEntity roadEntity : list){
                    res = vulnerabilityRepository.saveRoad(roadEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //导入生命线-桥梁excel
    private Map<String, Object> uploadBridgeExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setImportFields(new String[]{"编码","桥梁名称","所在位置","跨越地物名称","抗震设防烈度","建造年代","桥梁结构类型","最大跨径","跨径总长","场地土分类","桥梁等级","地基失效程度","上部结构","支座形式","桥墩高度","桥墩材料","基础型式","最大载重量","桥台材料","桥台类型","伸缩缝数量","桥梁宽度","简介","省","市","区/县","经度","纬度"});
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<BridgeEntity> result = ExcelImportUtil.importExcelMore(inputStream, BridgeEntity.class, params);
            /*List<PoolEntity> failList = result.getFailList();
            if (PlatformObjectUtils.isNotEmpty(failList)) {
                StringBuilder errorMsg = new StringBuilder("<font size='5px' color='red'>导入失败：</font>");
                for (PoolEntity poolEntity : failList) {
                    errorMsg.append("<font size='4px' ><br>").append("第").append(waterWorksEntity.getRowNum() + 1).append("行： ").append(waterWorksEntity.getErrorMsg()).append("</font>");
                }
                map.put("res", res);
                map.put("mess", errorMsg);
                return map;
            }*/
            List<BridgeEntity> resultData = result.getList();
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<BridgeEntity> pointList = new ArrayList<>();
                for (BridgeEntity bridgeEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    bridgeEntity.setCbId(uuid);
                    bridgeEntity.setAcrossObject(getKeyByValue("smxqlkydwmc",bridgeEntity.getAcrossObject()));
                    bridgeEntity.setStructure(getKeyByValue("smxqljglx",bridgeEntity.getStructure()));
                    bridgeEntity.setGrade(getKeyByValue("smxqldj",bridgeEntity.getGrade()));
                    bridgeEntity.setFoundationFail(getKeyByValue("smxqldjsxcd",bridgeEntity.getFoundationFail()));
                    bridgeEntity.setSuperStructure(getKeyByValue("smxqlsbjg",bridgeEntity.getSuperStructure()));
                    bridgeEntity.setBearing(getKeyByValue("smxqlsbjg",bridgeEntity.getBearing()));
                    bridgeEntity.setPierMaterial(getKeyByValue("smxqlqdcl",bridgeEntity.getPierMaterial()));
                    bridgeEntity.setBasement(getKeyByValue("smxqljcxs",bridgeEntity.getBasement()));
                    bridgeEntity.setAbutmentMat(getKeyByValue("smxqlqdcl",bridgeEntity.getPierMaterial()));
                    bridgeEntity.setAbutmentType(getKeyByValue("smxqlqtlx",bridgeEntity.getAbutmentType()));

                    bridgeEntity.setCreateUser(userId);
                    bridgeEntity.setCreateTime(new Date());
                    bridgeEntity.setDelFlag("0");
                    bridgeEntity.setAttachId(attachId);
                    String longitude = bridgeEntity.getLongitude();
                    String latitude = bridgeEntity.getLatitude();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    bridgeEntity.setGeom(geom);
                    pointList.add(bridgeEntity);
                }
                for(BridgeEntity bridgeEntity : pointList){
                    res = vulnerabilityRepository.saveBridgePoint(bridgeEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //导入生命线-储蓄罐excel
    private Map<String, Object> uploadAirReceiverExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setImportFields(new String[]{"储气罐编码","储气罐名称","经度","纬度","型号","公称容积","工作压力","筒体内径","筒体高度","筒体、封头壁厚","参考重量","结构材料","导轨长度","导轨高度","导轨中腹厚度","基础形式","材料型号","弹性模量","屈服应力","许用应力","场地类别","6度时液化程度","7度时液化程度","8度时液化程度","9度时液化程度","6度时震陷程度","7度时震陷程度","8度时震陷程度","9度时震陷程度","建设年代","设防烈度","省","市","区/县"});
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<AirReceiverEntity> result = ExcelImportUtil.importExcelMore(inputStream, AirReceiverEntity.class, params);
            /*List<PoolEntity> failList = result.getFailList();
            if (PlatformObjectUtils.isNotEmpty(failList)) {
                StringBuilder errorMsg = new StringBuilder("<font size='5px' color='red'>导入失败：</font>");
                for (PoolEntity poolEntity : failList) {
                    errorMsg.append("<font size='4px' ><br>").append( "第").append(waterWorksEntity.getRowNum() + 1).append("行： ").append(waterWorksEntity.getErrorMsg()).append("</font>");
                }
                map.put("res", res);
                map.put("mess", errorMsg);
                return map;
            }*/
            List<AirReceiverEntity> resultData = result.getList();//解析excel
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<AirReceiverEntity> list = new ArrayList<>();
                for (AirReceiverEntity airReceiverEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    airReceiverEntity.setCarId(uuid);
                    airReceiverEntity.setCreateUser(userId);
                    airReceiverEntity.setCreateTime(new Date());
                    airReceiverEntity.setDelFlag("0");
                    airReceiverEntity.setAttachId(attachId);
                    airReceiverEntity.setSite(getKeyByValue("smxcdlb",airReceiverEntity.getSite()));//场地类别
                    airReceiverEntity.setLiquefaction6(getKeyByValue("smxyhcd",airReceiverEntity.getLiquefaction6()));
                    airReceiverEntity.setLiquefaction7(getKeyByValue("smxyhcd",airReceiverEntity.getLiquefaction7()));
                    airReceiverEntity.setLiquefaction8(getKeyByValue("smxyhcd",airReceiverEntity.getLiquefaction8()));
                    airReceiverEntity.setLiquefaction9(getKeyByValue("smxyhcd",airReceiverEntity.getLiquefaction9()));
                    airReceiverEntity.setSeismicSubsidence6(getKeyByValue("smxyhcd",airReceiverEntity.getSeismicSubsidence6()));
                    airReceiverEntity.setSeismicSubsidence7(getKeyByValue("smxyhcd",airReceiverEntity.getSeismicSubsidence7()));
                    airReceiverEntity.setSeismicSubsidence8(getKeyByValue("smxyhcd",airReceiverEntity.getSeismicSubsidence8()));
                    airReceiverEntity.setSeismicSubsidence9(getKeyByValue("smxyhcd",airReceiverEntity.getSeismicSubsidence9()));
                    airReceiverEntity.setIntensity(getKeyByValue("smxsfld",airReceiverEntity.getIntensity()));
                    String longitude = airReceiverEntity.getLongitude();
                    String latitude = airReceiverEntity.getLatitude();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    airReceiverEntity.setGeom(geom);
                    list.add(airReceiverEntity);
                }
                for(AirReceiverEntity airReceiverEntity : list){
                    res = vulnerabilityRepository.saveAirReceiver(airReceiverEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //上传水厂泵房excel
    private Map<String, Object> uploadWaterworksExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setImportFields(new String[]{"水厂名称","经度","纬度","建筑物编码","建筑物名称","结构类型","建筑层数","建筑面积","混凝土等级","砖砌体标号","场地类别","6度时液化程度","7度时液化程度","8度时液化程度","9度时液化程度","6度时震陷程度","7度时震陷程度","8度时震陷程度","9度时震陷程度","建设年代","设防烈度","省","市","区/县"});
        params.setNeedVerify(true);
        //1111params.setVerifyHandler(waterWorksExcelVerifyHandler);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<WaterWorksEntity> result = ExcelImportUtil.importExcelMore(inputStream, WaterWorksEntity.class, params);
            List<WaterWorksEntity> failList = result.getFailList();
            if (PlatformObjectUtils.isNotEmpty(failList)) {
                StringBuilder errorMsg = new StringBuilder("<font size='5px' color='red'>导入失败：</font>");
                for (WaterWorksEntity waterWorksEntity : failList) {
                    errorMsg.append("<font size='4px' ><br>").append("第").append(waterWorksEntity.getRowNum() + 1).append("行： ").append(waterWorksEntity.getErrorMsg()).append("</font>");
                }
                map.put("res", res);
                map.put("mess", errorMsg);
                return map;
            }
            List<WaterWorksEntity> resultData = result.getList();//解析excel
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<WaterWorksEntity> list = new ArrayList<>();
                for (WaterWorksEntity waterWorksEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    waterWorksEntity.setCwId(uuid);
                    String longitude = waterWorksEntity.getLongitude();
                    String latitude = waterWorksEntity.getLatitude();
                    waterWorksEntity.setType(getKeyByValue("smxscbfjglx",waterWorksEntity.getType()));//结构类型
                    waterWorksEntity.setSite(getKeyByValue("smxcdlb",waterWorksEntity.getSite()));//场地类别
                    waterWorksEntity.setLiquefaction6(getKeyByValue("smxyhcd",waterWorksEntity.getLiquefaction6()));
                    waterWorksEntity.setLiquefaction7(getKeyByValue("smxyhcd",waterWorksEntity.getLiquefaction7()));
                    waterWorksEntity.setLiquefaction8(getKeyByValue("smxyhcd",waterWorksEntity.getLiquefaction8()));
                    waterWorksEntity.setLiquefaction9(getKeyByValue("smxyhcd",waterWorksEntity.getLiquefaction9()));
                    waterWorksEntity.setSeismicSubsidence6(getKeyByValue("smxyhcd",waterWorksEntity.getSeismicSubsidence6()));
                    waterWorksEntity.setSeismicSubsidence7(getKeyByValue("smxyhcd",waterWorksEntity.getSeismicSubsidence7()));
                    waterWorksEntity.setSeismicSubsidence8(getKeyByValue("smxyhcd",waterWorksEntity.getSeismicSubsidence8()));
                    waterWorksEntity.setSeismicSubsidence9(getKeyByValue("smxyhcd",waterWorksEntity.getSeismicSubsidence9()));
                    waterWorksEntity.setIntensity(getKeyByValue("smxsfld",waterWorksEntity.getIntensity()));
                    String geom = "POINT("+longitude+" "+latitude+")";
                    waterWorksEntity.setGeom(geom);
                    waterWorksEntity.setCreateUser(userId);
                    waterWorksEntity.setCreateTime(new Date());
                    waterWorksEntity.setDelFlag("0");
                    waterWorksEntity.setAttachId(attachId);
                    list.add(waterWorksEntity);
                }
                for(WaterWorksEntity waterWorksEntity : list){
                    res = vulnerabilityRepository.saveWaterWork(waterWorksEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //上传地下管网Excel文件
    private Map<String, Object> uploadDxPipeNetworkExcel(MultipartFile file, String attachId, String province, String city,String county){
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setImportFields(new String[]{"管道编码","管道名称","管道类型","起点编号","终点编号","经度","纬度","管道长度","管材","管材型号","弹性模量","屈服极限应力","强度极限应力","许用应变","管道直径","管道壁厚","工作压力","接口形式","接口材料","接口许用伸长","场地类别","6度时液化程度","7度时液化程度","8度时液化程度","9度时液化程度","6度时震陷程度","7度时震陷程度","8度时震陷程度","9度时震陷程度","管道埋深","建设年代","设防烈度","省","市","区/县"});
        params.setNeedVerify(true);
        //params.setVerifyHandler(dxPipeNetworkExcelVerifyHandler);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<DxPipeNetworkEntity> result = ExcelImportUtil.importExcelMore(inputStream, DxPipeNetworkEntity.class, params);
            List<DxPipeNetworkEntity> failList = result.getFailList();
            if (PlatformObjectUtils.isNotEmpty(failList)) {
                StringBuilder errorMsg = new StringBuilder("<font size='5px' color='red'>导入失败：</font>");
                for(DxPipeNetworkEntity dxPipeNetworkEntity : failList){
                    errorMsg.append("<font size='4px' ><br>").append("第").append(dxPipeNetworkEntity.getRowNum() + 1).append("行： ").append(dxPipeNetworkEntity.getErrorMsg()).append("</font>");
                }
                map.put("res",res);
                map.put("mess",errorMsg);
                return map;
            }
            List<DxPipeNetworkEntity> resultData = result.getList();//解析excel
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<DxPipeNetworkEntity> list = new ArrayList<>();

                for (DxPipeNetworkEntity dxPipeNetworkEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    dxPipeNetworkEntity.setCdpnId(uuid);
                    dxPipeNetworkEntity.setAttachId(attachId);
                    /*dxPipeNetworkEntity.setProvince(province);
                    dxPipeNetworkEntity.setCity(city);
                    dxPipeNetworkEntity.setCounty(county);*/
                    String material = dxPipeNetworkEntity.getMaterial();//管材
                    dxPipeNetworkEntity.setMaterial(getKeyByValue("smxdxgwgc",material));
                    String joint = dxPipeNetworkEntity.getJoint();//接口形式
                    dxPipeNetworkEntity.setJoint(getKeyByValue("smxdxgwjkxs",joint));
                    String jointy = dxPipeNetworkEntity.getJointy();//接口材料
                    dxPipeNetworkEntity.setJointy(getKeyByValue("smxdxgwjkcl",jointy));
                    dxPipeNetworkEntity.setLiquefaction6(getKeyByValue("smxyhcd",dxPipeNetworkEntity.getLiquefaction6()));
                    dxPipeNetworkEntity.setLiquefaction7(getKeyByValue("smxyhcd",dxPipeNetworkEntity.getLiquefaction7()));
                    dxPipeNetworkEntity.setLiquefaction8(getKeyByValue("smxyhcd",dxPipeNetworkEntity.getLiquefaction8()));
                    dxPipeNetworkEntity.setLiquefaction9(getKeyByValue("smxyhcd",dxPipeNetworkEntity.getLiquefaction9()));
                    dxPipeNetworkEntity.setSeismicSubsidence6(getKeyByValue("smxyhcd",dxPipeNetworkEntity.getSeismicSubsidence6()));
                    dxPipeNetworkEntity.setSeismicSubsidence7(getKeyByValue("smxyhcd",dxPipeNetworkEntity.getSeismicSubsidence7()));
                    dxPipeNetworkEntity.setSeismicSubsidence8(getKeyByValue("smxyhcd",dxPipeNetworkEntity.getSeismicSubsidence8()));
                    dxPipeNetworkEntity.setSeismicSubsidence9(getKeyByValue("smxyhcd",dxPipeNetworkEntity.getSeismicSubsidence9()));
                    dxPipeNetworkEntity.setIntensity(getKeyByValue("smxsfld",dxPipeNetworkEntity.getIntensity()));
                    dxPipeNetworkEntity.setSite(getKeyByValue("smxcdlb",dxPipeNetworkEntity.getSite()));
                    String longitude = dxPipeNetworkEntity.getLongitude();
                    String latitude = dxPipeNetworkEntity.getLatitude();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    dxPipeNetworkEntity.setGeom(geom);
                    dxPipeNetworkEntity.setCreateUser(userId);
                    dxPipeNetworkEntity.setCreateTime(new Date());
                    dxPipeNetworkEntity.setDelFlag("0");
                    list.add(dxPipeNetworkEntity);
                }
                for(DxPipeNetworkEntity dxPipeNetworkEntity : list){
                    res = vulnerabilityRepository.saveDxPipeNetwork(dxPipeNetworkEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file, attachId, userId);//附件记录表
                }
            }
        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //水厂水池excel
    private Map<String, Object> uploadPoolExcel(MultipartFile file, String attachId, String province, String city, String county) {
        Map<String, Object> map = new HashMap<>();
        ImportParams params = new ImportParams();
        params.setImportFields(new String[]{"水池编码","结构形式","结构材料","水池壁厚","水池形状","水池半径","水池短边","水池长边","容量","水深度","水池高度","矩形水池顶盖整体性是否良好，与池壁、立柱是否有可靠连接","使用现状","施工质量","池壁内侧竖向配筋表面形状","池壁外侧竖向配筋表面形状","池壁内侧竖向配筋直径","池壁外侧竖向配筋直径","混凝土强度等级","池壁内侧竖向钢筋等级","池壁外侧竖向钢筋等级","池壁内侧最外层钢筋保护层厚度","池壁外侧最外层钢筋保护层厚度","池壁内侧竖向配筋","池壁外侧竖向配筋","设防烈度","场地类别","建设年代","6度时液化程度","7度时液化程度","8度时液化程度","9度时液化程度","6度时震陷程度","7度时震陷程度","8度时震陷程度","9度时震陷程度","省","市","区/县","经度","纬度"});
        params.setNeedVerify(true);
        boolean res = false;
        try {
            String userId = PlatformSessionContext.getUserID();
            InputStream inputStream = file.getInputStream();
            ExcelImportResult<PoolEntity> result = ExcelImportUtil.importExcelMore(inputStream, PoolEntity.class, params);
            /*List<PoolEntity> failList = result.getFailList();
            if (PlatformObjectUtils.isNotEmpty(failList)) {
                StringBuilder errorMsg = new StringBuilder("<font size='5px' color='red'>导入失败：</font>");
                for (PoolEntity poolEntity : failList) {
                    errorMsg.append("<font size='4px' ><br>").append("第").append(waterWorksEntity.getRowNum() + 1).append("行： ").append(waterWorksEntity.getErrorMsg()).append("</font>");
                }
                map.put("res", res);
                map.put("mess", errorMsg);
                return map;
            }*/
            List<PoolEntity> resultData = result.getList();//解析excel
            if (PlatformObjectUtils.isNotEmpty(resultData)) {
                List<PoolEntity> list = new ArrayList<>();
                for (PoolEntity poolEntity : resultData) {
                    String uuid = UUIDGenerator.getUUID();
                    poolEntity.setCpId(uuid);
                    poolEntity.setCreateUser(userId);
                    poolEntity.setCreateTime(new Date());
                    poolEntity.setDelFlag("0");
                    poolEntity.setAttachId(attachId);
                    String longitude = poolEntity.getLongitude();
                    String latitude = poolEntity.getLatitude();
                    String geom = "POINT("+longitude+" "+latitude+")";
                    poolEntity.setGeom(geom);
                    poolEntity.setStyle(getKeyByValue("smxscscjgxs",poolEntity.getStyle()));//结构形式
                    poolEntity.setMaterial(getKeyByValue("smxscscjgcl",poolEntity.getMaterial()));//结构材料
                    poolEntity.setShape(getKeyByValue("smxscscscxz",poolEntity.getMaterial()));//水池形状
                    poolEntity.setSurfaceShape1(getKeyByValue("smxscsccbsxpjbmxz",poolEntity.getSurfaceShape1()));
                    poolEntity.setSurfaceShape2(getKeyByValue("smxscsccbsxpjbmxz",poolEntity.getSurfaceShape2()));
                    poolEntity.setKinds1(getKeyByValue("smxscsccbsxgjdj",poolEntity.getKinds1()));
                    poolEntity.setKinds2(getKeyByValue("smxscsccbsxgjdj",poolEntity.getKinds2()));
                    poolEntity.setLiquefaction6(getKeyByValue("smxyhcd",poolEntity.getLiquefaction6()));
                    poolEntity.setLiquefaction7(getKeyByValue("smxyhcd",poolEntity.getLiquefaction7()));
                    poolEntity.setLiquefaction8(getKeyByValue("smxyhcd",poolEntity.getLiquefaction8()));
                    poolEntity.setLiquefaction9(getKeyByValue("smxyhcd",poolEntity.getLiquefaction9()));
                    poolEntity.setLandform6(getKeyByValue("smxyhcd",poolEntity.getLandform6()));
                    poolEntity.setLandform7(getKeyByValue("smxyhcd",poolEntity.getLandform7()));
                    poolEntity.setLandform8(getKeyByValue("smxyhcd",poolEntity.getLandform8()));
                    poolEntity.setLandform9(getKeyByValue("smxyhcd",poolEntity.getLandform9()));
                    poolEntity.setIntensity(getKeyByValue("smxsfld",poolEntity.getIntensity()));
                    poolEntity.setSite(getKeyByValue("smxcdlb",poolEntity.getSite()));
                    list.add(poolEntity);
                }
                for(PoolEntity poolEntity : list){
                    res = vulnerabilityRepository.savePool(poolEntity);
                }
                if(res){
                    res = saveLifelineAttachmentRecord(file,attachId,userId);
                }
            }

        }catch (Exception e) {
            if (e.getMessage().contains("不是合法")) {
                map.put("res",false);
                map.put("mess","上传失败! 上传的文件模板有误,请检查表头是否改动！");
            }
            e.printStackTrace();
        }
        map.put("res",res);
        return map;
    }

    //保存附件记录
    private boolean saveLifelineAttachmentRecord(MultipartFile file, String attachId, String userId){
        Resource resource = file.getResource();
        String fileName = resource.getFilename();
        LifelineAttachmentRecordEntity lifelineAttachmentRecord = new LifelineAttachmentRecordEntity();
        lifelineAttachmentRecord.setId(UUIDGenerator.getUUID());
        lifelineAttachmentRecord.setAttachId(attachId);
        lifelineAttachmentRecord.setAttachName(fileName);
        lifelineAttachmentRecord.setType("1");
        lifelineAttachmentRecord.setFileType("0");
        lifelineAttachmentRecord.setCreateUser(userId);
        lifelineAttachmentRecord.setCreateTime(new Date());
        lifelineAttachmentRecord.setDelFlag("0");
        return vulnerabilityRepository.saveLifelineAttachmentRecord(lifelineAttachmentRecord);

    }
    private boolean saveLifelineAttachmentRecord(String attachId, String  userId){
        /*Resource resource = file.getResource();
        String fileName = resource.getFilename();*/
        LifelineAttachmentRecordEntity lifelineAttachmentRecord = new LifelineAttachmentRecordEntity();
        lifelineAttachmentRecord.setId(UUIDGenerator.getUUID());
        lifelineAttachmentRecord.setAttachId(attachId);
        //lifelineAttachmentRecord.setAttachName(fileName);
        lifelineAttachmentRecord.setType("1");
        lifelineAttachmentRecord.setFileType("0");
        lifelineAttachmentRecord.setCreateUser(userId);
        lifelineAttachmentRecord.setCreateTime(new Date());
        lifelineAttachmentRecord.setDelFlag("0");
        return vulnerabilityRepository.saveLifelineAttachmentRecord(lifelineAttachmentRecord);

    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Map<String, Object> uploadShp(String fileIds, String type) {
        //type 1:地下管网   2:水厂泵房  3:水厂水池  4:燃气-储气罐    5:桥梁    6:道路    7:变电站
        // 8:架空线路  9:电缆线路  10:发电厂  11:通信室内设备   12:电视塔   14:水库大坝
        Map<String, Object> map = new HashMap<>();
        try {
            if(type.equals("1")){
                map = uploadDxPipeNetworkShp(fileIds);
            }else if(type.equals("2")){
                map = uploadWaterworksShp(fileIds);
            }else if(type.equals("3")){
                map = uploadPoolShp(fileIds);
            }else if(type.equals("4")){
                map = uploadAirReceiverShp(fileIds);
            }else if(type.equals("5")){
                map = uploadBridgeShp(fileIds);
            }else if(type.equals("6")){
                map = uploadRoadShp(fileIds);
            }else if(type.equals("7")){
                map = uploadTransformerSubstationShp(fileIds);
            }else if(type.equals("8")){
                map = uploadOverheadLineShp(fileIds);
            }else if(type.equals("9")){
                map = uploadCableRouteShp(fileIds);
            }else if(type.equals("10")){
                map = uploadImportantPowerhouseShp(fileIds);
            }else if(type.equals("11")){
                map = uploadCommIndoorEquipmentShp(fileIds);
            }else if(type.equals("12")){
                map = uploadTvTowerShp(fileIds);
            }else if(type.equals("13")){

            }else if(type.equals("14")){
                map = uploadReserviorShp(fileIds);
            }
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            map.put("res",false);
            map.put("mess","该数据类别下没有shp数据");
        }
        return map;
    }

    private Map<String, Object> uploadReserviorShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<RdInformationEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 20) {
                return null;
            }
            RdInformationEntity rdInformationEntity = new RdInformationEntity();
            rdInformationEntity.setCreateUser(PlatformSessionContext.getUserID());
            rdInformationEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            rdInformationEntity.setDelFlag(YNEnum.N.toString());
            rdInformationEntity.setAttachId(fileIds);
            rdInformationEntity.setCrId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                rdInformationEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                rdInformationEntity.setCrName(ShpAnalyticUtil.getStringVal(list.get(2).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                rdInformationEntity.setLocation(ShpAnalyticUtil.getStringVal(list.get(3).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                rdInformationEntity.setLongitude(ShpAnalyticUtil.getStringVal(list.get(4).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                rdInformationEntity.setLatitude(ShpAnalyticUtil.getStringVal(list.get(5).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                rdInformationEntity.setCapacity(ShpAnalyticUtil.getDoubleVal(list.get(6).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                rdInformationEntity.setYear(ShpAnalyticUtil.getStringVal(list.get(7).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                rdInformationEntity.setDamLength(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                rdInformationEntity.setDamHeight(ShpAnalyticUtil.getDoubleVal(list.get(9).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                rdInformationEntity.setTopWidth(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                rdInformationEntity.setStructureType(getKeyByValue("smxskdbjglx",ShpAnalyticUtil.getStringVal(list.get(11).toString(),"",false)));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                rdInformationEntity.setType(getKeyByValue("smxskdbsblx",ShpAnalyticUtil.getStringVal(list.get(12).toString(),"",false)));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                rdInformationEntity.setIntensity(ShpAnalyticUtil.getStringVal(list.get(13).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                rdInformationEntity.setSite(ShpAnalyticUtil.getStringVal(list.get(14).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                rdInformationEntity.setSpace(getKeyByValue("smxskdbcd",ShpAnalyticUtil.getStringVal(list.get(15).toString(),"",false)));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(16))) {
                rdInformationEntity.setFilling(getKeyByValue("smxskdbtl",ShpAnalyticUtil.getStringVal(list.get(16).toString(),"",false)));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(17))) {
                rdInformationEntity.setDamFoundation(getKeyByValue("smxskdbbj",ShpAnalyticUtil.getStringVal(list.get(17).toString(),"",false)));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(18))) {
                rdInformationEntity.setMaintenanceStatus(getKeyByValue("smxskdbwhxz",ShpAnalyticUtil.getStringVal(list.get(18).toString(),"",false)));
            }
            if(list.size()>19 && !PlatformObjectUtils.isEmpty(list.get(19))) {
                rdInformationEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(19).toString(),"",false));
            }
            if(list.size()>20 && !PlatformObjectUtils.isEmpty(list.get(20))) {
                rdInformationEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(20).toString(),"",false));
            }
            if(list.size()>21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                rdInformationEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(21).toString(),"",false));
            }
            if(list.size()>22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                rdInformationEntity.setExtends1(list.get(22).toString());
            }
            if(list.size()>23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                rdInformationEntity.setExtends2(list.get(23).toString());
            }
            if(list.size()>24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                rdInformationEntity.setExtends3(list.get(24).toString());
            }
            if(list.size()>25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                rdInformationEntity.setExtends4(list.get(25).toString());
            }
            if(list.size()>26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                rdInformationEntity.setExtends5(list.get(26).toString());
            }
            if(list.size()>27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                rdInformationEntity.setExtends6(list.get(27).toString());
            }
            if(list.size()>28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                rdInformationEntity.setExtends7(list.get(28).toString());
            }
            if(list.size()>29 && !PlatformObjectUtils.isEmpty(list.get(29))) {
                rdInformationEntity.setExtends8(list.get(29).toString());
            }
            if(list.size()>30 && !PlatformObjectUtils.isEmpty(list.get(30))) {
                rdInformationEntity.setExtends9(list.get(30).toString());
            }
            if(list.size()>31 && !PlatformObjectUtils.isEmpty(list.get(31))) {
                rdInformationEntity.setExtends10(list.get(31).toString());
            }
            arrayList.add(rdInformationEntity);
        }
        boolean res = false;
        for (RdInformationEntity rdInformationEntity : arrayList) {
            res = domeFacilitiesRepository.saveRdInformation(rdInformationEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }


    //电视塔shp
    private Map<String, Object> uploadTvTowerShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<TvTowerEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 21) {
                return null;
            }
            TvTowerEntity tvTowerEntity = new TvTowerEntity();
            tvTowerEntity.setCreateUser(PlatformSessionContext.getUserID());
            tvTowerEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            tvTowerEntity.setDelFlag(YNEnum.N.toString());
            tvTowerEntity.setAttachId(fileIds);
            tvTowerEntity.setCttId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                tvTowerEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                tvTowerEntity.setObjectName(ShpAnalyticUtil.getStringVal(list.get(1).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                tvTowerEntity.setLocation(ShpAnalyticUtil.getStringVal(list.get(2).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                tvTowerEntity.setObjectLon(ShpAnalyticUtil.getStringVal(list.get(3).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                tvTowerEntity.setObjectLat(ShpAnalyticUtil.getStringVal(list.get(4).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                tvTowerEntity.setCttType(ShpAnalyticUtil.getStringVal(list.get(5).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                tvTowerEntity.setArea(ShpAnalyticUtil.getDoubleVal(list.get(6).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                tvTowerEntity.setYear(ShpAnalyticUtil.getStringVal(list.get(7).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                tvTowerEntity.setHeight(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                tvTowerEntity.setTowerElevation(ShpAnalyticUtil.getDoubleVal(list.get(9).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                tvTowerEntity.setBuldingSite(ShpAnalyticUtil.getStringVal(list.get(10).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                tvTowerEntity.setDesignIntensity(ShpAnalyticUtil.getIntegerVal(list.get(11).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                tvTowerEntity.setFieldType(ShpAnalyticUtil.getIntegerVal(list.get(12).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                tvTowerEntity.setStatus(ShpAnalyticUtil.getStringVal(list.get(13).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                tvTowerEntity.setReconstructionCost(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                tvTowerEntity.setAntennaElevation(ShpAnalyticUtil.getDoubleVal(list.get(15).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(16))) {
                tvTowerEntity.setPeriod(ShpAnalyticUtil.getDoubleVal(list.get(16).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(17))) {
                tvTowerEntity.setColmnType(ShpAnalyticUtil.getStringVal(list.get(17).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(18))) {
                tvTowerEntity.setBaseType(ShpAnalyticUtil.getStringVal(list.get(18).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(19))) {
                tvTowerEntity.setBaseStoryNum(ShpAnalyticUtil.getIntegerVal(list.get(19).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(20))) {
                tvTowerEntity.setBaseHeight(ShpAnalyticUtil.getDoubleVal(list.get(20).toString(),"",false));
            }
            if(list.size()>21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                tvTowerEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(21).toString(),"",false));
            }
            if(list.size()>22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                tvTowerEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(22).toString(),"",false));
            }
            if(list.size()>23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                tvTowerEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(23).toString(),"",false));
            }
            if(list.size()>24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                tvTowerEntity.setExtends1(list.get(24).toString());
            }
            if(list.size()>25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                tvTowerEntity.setExtends2(list.get(25).toString());
            }
            if(list.size()>26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                tvTowerEntity.setExtends3(list.get(26).toString());
            }
            if(list.size()>27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                tvTowerEntity.setExtends4(list.get(27).toString());
            }
            if(list.size()>28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                tvTowerEntity.setExtends5(list.get(28).toString());
            }
            if(list.size()>29 && !PlatformObjectUtils.isEmpty(list.get(29))) {
                tvTowerEntity.setExtends6(list.get(29).toString());
            }
            if(list.size()>30 && !PlatformObjectUtils.isEmpty(list.get(30))) {
                tvTowerEntity.setExtends7(list.get(30).toString());
            }
            if(list.size()>31 && !PlatformObjectUtils.isEmpty(list.get(31))) {
                tvTowerEntity.setExtends8(list.get(31).toString());
            }
            if(list.size()>32 && !PlatformObjectUtils.isEmpty(list.get(32))) {
                tvTowerEntity.setExtends9(list.get(32).toString());
            }
            if(list.size()>33 && !PlatformObjectUtils.isEmpty(list.get(33))) {
                tvTowerEntity.setExtends10(list.get(33).toString());
            }
            arrayList.add(tvTowerEntity);
        }
        boolean res = false;
        for (TvTowerEntity tvTowerEntity : arrayList) {
            res = vulnerabilityRepository.saveTvTower(tvTowerEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //通信室内设备shp
    private Map<String, Object> uploadCommIndoorEquipmentShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<CommIndoorEquipmentEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 15) {
                return null;
            }
            CommIndoorEquipmentEntity commIndoorEquipmentEntity = new CommIndoorEquipmentEntity();
            commIndoorEquipmentEntity.setCreateUser(PlatformSessionContext.getUserID());
            commIndoorEquipmentEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            commIndoorEquipmentEntity.setDelFlag(YNEnum.N.toString());
            commIndoorEquipmentEntity.setAttachId(fileIds);
            commIndoorEquipmentEntity.setCcieId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                commIndoorEquipmentEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                commIndoorEquipmentEntity.setInObjectName(ShpAnalyticUtil.getStringVal(list.get(1).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                commIndoorEquipmentEntity.setLocation(ShpAnalyticUtil.getStringVal(list.get(2).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                commIndoorEquipmentEntity.setObjectLon(ShpAnalyticUtil.getStringVal(list.get(3).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                commIndoorEquipmentEntity.setObjectLat(ShpAnalyticUtil.getStringVal(list.get(4).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                commIndoorEquipmentEntity.setDeviceType(ShpAnalyticUtil.getStringVal(list.get(5).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                commIndoorEquipmentEntity.setDeviceName(ShpAnalyticUtil.getStringVal(list.get(6).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                commIndoorEquipmentEntity.setModel(ShpAnalyticUtil.getStringVal(list.get(7).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                commIndoorEquipmentEntity.setInFloor(ShpAnalyticUtil.getIntegerVal(list.get(8).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                commIndoorEquipmentEntity.setFixedForm(ShpAnalyticUtil.getStringVal(list.get(9).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                commIndoorEquipmentEntity.setBoltDiameter(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                commIndoorEquipmentEntity.setPurchaseCost(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                commIndoorEquipmentEntity.setManufacturers(ShpAnalyticUtil.getStringVal(list.get(12).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                commIndoorEquipmentEntity.setSize(ShpAnalyticUtil.getStringVal(list.get(13).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                commIndoorEquipmentEntity.setWeight(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(),"",false));
            }
            if(list.size()>15 && !PlatformObjectUtils.isEmpty(list.get(15))) {
                commIndoorEquipmentEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(15).toString(),"",false));
            }
            if(list.size()>16 && !PlatformObjectUtils.isEmpty(list.get(16))) {
                commIndoorEquipmentEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(16).toString(),"",false));
            }
            if(list.size()>17 && !PlatformObjectUtils.isEmpty(list.get(17))) {
                commIndoorEquipmentEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(17).toString(),"",false));
            }
            if(list.size()>18 && !PlatformObjectUtils.isEmpty(list.get(18))) {
                commIndoorEquipmentEntity.setExtends1(list.get(18).toString());
            }
            if(list.size()>19 && !PlatformObjectUtils.isEmpty(list.get(19))) {
                commIndoorEquipmentEntity.setExtends2(list.get(19).toString());
            }
            if(list.size()>20 && !PlatformObjectUtils.isEmpty(list.get(20))) {
                commIndoorEquipmentEntity.setExtends3(list.get(20).toString());
            }
            if(list.size()>21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                commIndoorEquipmentEntity.setExtends4(list.get(21).toString());
            }
            if(list.size()>22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                commIndoorEquipmentEntity.setExtends5(list.get(22).toString());
            }
            if(list.size()>23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                commIndoorEquipmentEntity.setExtends6(list.get(23).toString());
            }
            if(list.size()>24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                commIndoorEquipmentEntity.setExtends7(list.get(24).toString());
            }
            if(list.size()>25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                commIndoorEquipmentEntity.setExtends8(list.get(25).toString());
            }
            if(list.size()>26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                commIndoorEquipmentEntity.setExtends9(list.get(26).toString());
            }
            if(list.size()>27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                commIndoorEquipmentEntity.setExtends10(list.get(27).toString());
            }
            arrayList.add(commIndoorEquipmentEntity);
        }
        boolean res = false;
        for (CommIndoorEquipmentEntity commIndoorEquipmentEntity : arrayList) {
            res = vulnerabilityRepository.saveCommIndoorEquipment(commIndoorEquipmentEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //发电厂shp
    private Map<String, Object> uploadImportantPowerhouseShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<ImportantPowerhouseEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 19) {
                return null;
            }
            ImportantPowerhouseEntity importantPowerhouseEntity = new ImportantPowerhouseEntity();
            importantPowerhouseEntity.setCreateUser(PlatformSessionContext.getUserID());
            importantPowerhouseEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            importantPowerhouseEntity.setDelFlag(YNEnum.N.toString());
            importantPowerhouseEntity.setAttachId(fileIds);
            importantPowerhouseEntity.setCipId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                importantPowerhouseEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                importantPowerhouseEntity.setId(ShpAnalyticUtil.getStringVal(list.get(1).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                importantPowerhouseEntity.setCipName(ShpAnalyticUtil.getStringVal(list.get(2).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                importantPowerhouseEntity.setPosition(ShpAnalyticUtil.getStringVal(list.get(3).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                importantPowerhouseEntity.setLongitude(ShpAnalyticUtil.getStringVal(list.get(4).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                importantPowerhouseEntity.setLatitude(ShpAnalyticUtil.getStringVal(list.get(5).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                importantPowerhouseEntity.setYear(ShpAnalyticUtil.getIntegerVal(list.get(6).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                importantPowerhouseEntity.setFortificationIntensity(ShpAnalyticUtil.getStringVal(list.get(7).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                importantPowerhouseEntity.setInstalledCapacity(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                importantPowerhouseEntity.setGeneratingType(ShpAnalyticUtil.getStringVal(list.get(9).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                importantPowerhouseEntity.setCostPowerPlant(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                importantPowerhouseEntity.setCostSubstationEquipment(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                importantPowerhouseEntity.setCostGeneratingEquipment(ShpAnalyticUtil.getDoubleVal(list.get(12).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                importantPowerhouseEntity.setAreaSteelStructures(ShpAnalyticUtil.getDoubleVal(list.get(13).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                importantPowerhouseEntity.setUnitCostSteelStructure(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                importantPowerhouseEntity.setAreaReinforcedConcrete(ShpAnalyticUtil.getDoubleVal(list.get(15).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(16))) {
                importantPowerhouseEntity.setUnitCostReinforcedConcrete(ShpAnalyticUtil.getDoubleVal(list.get(16).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(17))) {
                importantPowerhouseEntity.setAreaMasonryStructure(ShpAnalyticUtil.getDoubleVal(list.get(17).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(18))) {
                importantPowerhouseEntity.setUnitCostmasonryStructure(ShpAnalyticUtil.getDoubleVal(list.get(18).toString(),"",false));
            }
            if(list.size()>19 && !PlatformObjectUtils.isEmpty(list.get(19))) {
                importantPowerhouseEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(19).toString(), "", false));
            }
            if(list.size()>20 && !PlatformObjectUtils.isEmpty(list.get(20))) {
                importantPowerhouseEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(20).toString(), "", false));
            }
            if(list.size()>21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                importantPowerhouseEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(21).toString(), "", false));
            }
            if(list.size()>22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                importantPowerhouseEntity.setExtends1(list.get(22).toString());
            }
            if(list.size()>23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                importantPowerhouseEntity.setExtends2(list.get(23).toString());
            }
            if(list.size()>24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                importantPowerhouseEntity.setExtends3(list.get(24).toString());
            }
            if(list.size()>25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                importantPowerhouseEntity.setExtends4(list.get(25).toString());
            }
            if(list.size()>26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                importantPowerhouseEntity.setExtends5(list.get(26).toString());
            }
            if(list.size()>27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                importantPowerhouseEntity.setExtends6(list.get(27).toString());
            }
            if(list.size()>28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                importantPowerhouseEntity.setExtends7(list.get(28).toString());
            }
            if(list.size()>29 && !PlatformObjectUtils.isEmpty(list.get(29))) {
                importantPowerhouseEntity.setExtends8(list.get(29).toString());
            }
            if(list.size()>30 && !PlatformObjectUtils.isEmpty(list.get(30))) {
                importantPowerhouseEntity.setExtends9(list.get(30).toString());
            }
            if(list.size()>31 && !PlatformObjectUtils.isEmpty(list.get(31))) {
                importantPowerhouseEntity.setExtends10(list.get(31).toString());
            }
            arrayList.add(importantPowerhouseEntity);
        }
        boolean res = false;
        for (ImportantPowerhouseEntity importantPowerhouseEntity : arrayList) {
            res = vulnerabilityRepository.saveImportantPowerhouse(importantPowerhouseEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //电缆线路shp
    private Map<String, Object> uploadCableRouteShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<CableRouteEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 6) {
                return null;
            }
            CableRouteEntity cableRouteEntity = new CableRouteEntity();
            cableRouteEntity.setCreateUser(PlatformSessionContext.getUserID());
            cableRouteEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            cableRouteEntity.setDelFlag(YNEnum.N.toString());
            cableRouteEntity.setAttachId(fileIds);
            cableRouteEntity.setCcrId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                cableRouteEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                cableRouteEntity.setId(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                cableRouteEntity.setCcrName(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                cableRouteEntity.setFortificationIntensity(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                cableRouteEntity.setLineLength(ShpAnalyticUtil.getDoubleVal(list.get(4).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                cableRouteEntity.setCostLine(ShpAnalyticUtil.getDoubleVal(list.get(5).toString(), "", false));
            }
            if(list.size()>6 && !PlatformObjectUtils.isEmpty(list.get(6))) {
                cableRouteEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(6).toString(), "", false));
            }
            if(list.size()>7 && !PlatformObjectUtils.isEmpty(list.get(7))) {
                cableRouteEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", false));
            }
            if(list.size()>8 && !PlatformObjectUtils.isEmpty(list.get(8))) {
                cableRouteEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(8).toString(), "", false));
            }
            if(list.size()>9 && !PlatformObjectUtils.isEmpty(list.get(9))) {
                cableRouteEntity.setExtends1(list.get(9).toString());
            }
            if(list.size()>10 && !PlatformObjectUtils.isEmpty(list.get(10))) {
                cableRouteEntity.setExtends2(list.get(10).toString());
            }
            if(list.size()>11 && !PlatformObjectUtils.isEmpty(list.get(11))) {
                cableRouteEntity.setExtends3(list.get(11).toString());
            }
            if(list.size()>12 && !PlatformObjectUtils.isEmpty(list.get(12))) {
                cableRouteEntity.setExtends4(list.get(12).toString());
            }
            if(list.size()>13 && !PlatformObjectUtils.isEmpty(list.get(13))) {
                cableRouteEntity.setExtends5(list.get(13).toString());
            }
            if(list.size()>14 && !PlatformObjectUtils.isEmpty(list.get(14))) {
                cableRouteEntity.setExtends6(list.get(14).toString());
            }
            if(list.size()>15 && !PlatformObjectUtils.isEmpty(list.get(15))) {
                cableRouteEntity.setExtends7(list.get(15).toString());
            }
            if(list.size()>16 && !PlatformObjectUtils.isEmpty(list.get(16))) {
                cableRouteEntity.setExtends8(list.get(16).toString());
            }
            if(list.size()>17 && !PlatformObjectUtils.isEmpty(list.get(17))) {
                cableRouteEntity.setExtends9(list.get(17).toString());
            }
            if(list.size()>18 && !PlatformObjectUtils.isEmpty(list.get(18))) {
                cableRouteEntity.setExtends10(list.get(18).toString());
            }
            arrayList.add(cableRouteEntity);
        }
        boolean res = false;
        for (CableRouteEntity cableRouteEntity : arrayList) {
            res = vulnerabilityRepository.saveCableRoute(cableRouteEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //架空线路shp
    private Map<String, Object> uploadOverheadLineShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<OverheadLineEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 52) {
                return null;
            }
            OverheadLineEntity overheadLineEntity = new OverheadLineEntity();
            overheadLineEntity.setCreateUser(PlatformSessionContext.getUserID());
            overheadLineEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            overheadLineEntity.setDelFlag(YNEnum.N.toString());
            overheadLineEntity.setAttachId(fileIds);
            overheadLineEntity.setColId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                overheadLineEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                overheadLineEntity.setId(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                overheadLineEntity.setColName(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                overheadLineEntity.setFortificationIntensity(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                overheadLineEntity.setVoltageGrade35(ShpAnalyticUtil.getDoubleVal(list.get(4).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                overheadLineEntity.setLineLength35(ShpAnalyticUtil.getDoubleVal(list.get(5).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                overheadLineEntity.setLoopLength35(ShpAnalyticUtil.getDoubleVal(list.get(6).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                overheadLineEntity.setLandform35(ShpAnalyticUtil.getStringVal(list.get(7).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                overheadLineEntity.setUnitCostLine35(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                overheadLineEntity.setType35(ShpAnalyticUtil.getStringVal(list.get(9).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                overheadLineEntity.setNumber35(ShpAnalyticUtil.getIntegerVal(list.get(10).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                overheadLineEntity.setUnitCostTower35(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                overheadLineEntity.setVoltageGrade66(ShpAnalyticUtil.getDoubleVal(list.get(12).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                overheadLineEntity.setLineLength66(ShpAnalyticUtil.getDoubleVal(list.get(13).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                overheadLineEntity.setLoopLength66(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                overheadLineEntity.setLandform66(ShpAnalyticUtil.getStringVal(list.get(15).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(16))) {
                overheadLineEntity.setUnitCostLine66(ShpAnalyticUtil.getDoubleVal(list.get(16).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(17))) {
                overheadLineEntity.setType66(ShpAnalyticUtil.getStringVal(list.get(17).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(18))) {
                overheadLineEntity.setNumber66(ShpAnalyticUtil.getDoubleVal(list.get(18),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(19))) {
                overheadLineEntity.setUnitCostTower66(ShpAnalyticUtil.getDoubleVal(list.get(19).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(20))) {
                overheadLineEntity.setVoltageGrade110(ShpAnalyticUtil.getDoubleVal(list.get(20).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(21))) {
                overheadLineEntity.setLineLength110(ShpAnalyticUtil.getDoubleVal(list.get(21).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(22))) {
                overheadLineEntity.setLoopLength110(ShpAnalyticUtil.getDoubleVal(list.get(22).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(23))) {
                overheadLineEntity.setLandform110(ShpAnalyticUtil.getStringVal(list.get(23).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(24))) {
                overheadLineEntity.setUnitCostLine110(ShpAnalyticUtil.getDoubleVal(list.get(24).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(25))) {
                overheadLineEntity.setType110(ShpAnalyticUtil.getStringVal(list.get(25).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(26))) {
                overheadLineEntity.setNumber110(ShpAnalyticUtil.getDoubleVal(list.get(26),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(27))) {
                overheadLineEntity.setUnitCostTower110(ShpAnalyticUtil.getDoubleVal(list.get(27).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(28))) {
                overheadLineEntity.setVoltageGrade220(ShpAnalyticUtil.getDoubleVal(list.get(28).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(29))) {
                overheadLineEntity.setLineLength220(ShpAnalyticUtil.getDoubleVal(list.get(29).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(30))) {
                overheadLineEntity.setLoopLength220(ShpAnalyticUtil.getDoubleVal(list.get(30).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(31))) {
                overheadLineEntity.setLandform220(ShpAnalyticUtil.getStringVal(list.get(31).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(32))) {
                overheadLineEntity.setUnitCostLine220(ShpAnalyticUtil.getDoubleVal(list.get(32).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(33))) {
                overheadLineEntity.setType220(ShpAnalyticUtil.getStringVal(list.get(33).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(34))) {
                overheadLineEntity.setNumber220(ShpAnalyticUtil.getDoubleVal(list.get(34),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(35))) {
                overheadLineEntity.setUnitCostTower220(ShpAnalyticUtil.getDoubleVal(list.get(35).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(36))) {
                overheadLineEntity.setVoltageGrade330(ShpAnalyticUtil.getDoubleVal(list.get(36).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(37))) {
                overheadLineEntity.setLineLength330(ShpAnalyticUtil.getDoubleVal(list.get(37).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(38))) {
                overheadLineEntity.setLoopLength330(ShpAnalyticUtil.getDoubleVal(list.get(38).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(39))) {
                overheadLineEntity.setLandform330(ShpAnalyticUtil.getStringVal(list.get(39).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(40))) {
                overheadLineEntity.setUnitCostLine330(ShpAnalyticUtil.getDoubleVal(list.get(40).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(41))) {
                overheadLineEntity.setType330(ShpAnalyticUtil.getStringVal(list.get(41).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(42))) {
                overheadLineEntity.setNumber330(ShpAnalyticUtil.getDoubleVal(list.get(42),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(43))) {
                overheadLineEntity.setUnitCostTower330(ShpAnalyticUtil.getDoubleVal(list.get(43).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(44))) {
                overheadLineEntity.setVoltageGrade500(ShpAnalyticUtil.getDoubleVal(list.get(44).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(45))) {
                overheadLineEntity.setLineLength500(ShpAnalyticUtil.getDoubleVal(list.get(45).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(46))) {
                overheadLineEntity.setLoopLength500(ShpAnalyticUtil.getDoubleVal(list.get(46).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(47))) {
                overheadLineEntity.setLandform500(ShpAnalyticUtil.getStringVal(list.get(47).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(48))) {
                overheadLineEntity.setUnitCostLine500(ShpAnalyticUtil.getDoubleVal(list.get(48).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(49))) {
                overheadLineEntity.setType500(ShpAnalyticUtil.getStringVal(list.get(49).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(50))) {
                overheadLineEntity.setNumber500(ShpAnalyticUtil.getDoubleVal(list.get(50),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(51))) {
                overheadLineEntity.setUnitCostTower500(ShpAnalyticUtil.getDoubleVal(list.get(51).toString(),"",false));
            }
            if(list.size()>52 && !PlatformObjectUtils.isEmpty(list.get(52))) {
                overheadLineEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(52).toString(),"",false));
            }
            if(list.size()>53 && !PlatformObjectUtils.isEmpty(list.get(53))) {
                overheadLineEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(53).toString(),"",false));
            }
            if(list.size()>54 && !PlatformObjectUtils.isEmpty(list.get(54))) {
                overheadLineEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(54).toString(),"",false));
            }
            if(list.size()>55 && !PlatformObjectUtils.isEmpty(list.get(55))) {
                overheadLineEntity.setExtends1(list.get(55).toString());
            }
            if(list.size()>56 && !PlatformObjectUtils.isEmpty(list.get(56))) {
                overheadLineEntity.setExtends2(list.get(56).toString());
            }
            if(list.size()>57 && !PlatformObjectUtils.isEmpty(list.get(57))) {
                overheadLineEntity.setExtends3(list.get(57).toString());
            }
            if(list.size()>58 && !PlatformObjectUtils.isEmpty(list.get(58))) {
                overheadLineEntity.setExtends4(list.get(58).toString());
            }
            if(list.size()>59 && !PlatformObjectUtils.isEmpty(list.get(59))) {
                overheadLineEntity.setExtends5(list.get(59).toString());
            }
            if(list.size()>60 && !PlatformObjectUtils.isEmpty(list.get(60))) {
                overheadLineEntity.setExtends6(list.get(60).toString());
            }
            if(list.size()>61 && !PlatformObjectUtils.isEmpty(list.get(61))) {
                overheadLineEntity.setExtends7(list.get(61).toString());
            }
            if(list.size()>62 && !PlatformObjectUtils.isEmpty(list.get(62))) {
                overheadLineEntity.setExtends8(list.get(62).toString());
            }
            if(list.size()>63 && !PlatformObjectUtils.isEmpty(list.get(63))) {
                overheadLineEntity.setExtends9(list.get(63).toString());
            }
            if(list.size()>64 && !PlatformObjectUtils.isEmpty(list.get(64))) {
                overheadLineEntity.setExtends10(list.get(64).toString());
            }
            arrayList.add(overheadLineEntity);
        }
        boolean res = false;
        for (OverheadLineEntity overheadLineEntity : arrayList) {
            res = vulnerabilityRepository.saveOverheadLine(overheadLineEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //变电站Shp
    private Map<String, Object> uploadTransformerSubstationShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<TransformerSubstationEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 17) {
                return null;
            }
            TransformerSubstationEntity transformerSubstationEntity = new TransformerSubstationEntity();
            transformerSubstationEntity.setCtsId(UUIDGenerator.getUUID());
            transformerSubstationEntity.setCreateUser(PlatformSessionContext.getUserID());
            transformerSubstationEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            transformerSubstationEntity.setDelFlag(YNEnum.N.toString());
            transformerSubstationEntity.setAttachId(fileIds);
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                transformerSubstationEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                transformerSubstationEntity.setId(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                transformerSubstationEntity.setCtsName(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                transformerSubstationEntity.setPosition(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                transformerSubstationEntity.setLongitude(ShpAnalyticUtil.getStringVal(list.get(4).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                transformerSubstationEntity.setLatitude(ShpAnalyticUtil.getStringVal(list.get(5).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                transformerSubstationEntity.setTypeSubstation(ShpAnalyticUtil.getStringVal(list.get(6).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                transformerSubstationEntity.setVoltageGrade(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                transformerSubstationEntity.setStructureType(ShpAnalyticUtil.getStringVal(list.get(8).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                transformerSubstationEntity.setFortificationIntensity(ShpAnalyticUtil.getStringVal(list.get(9).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                transformerSubstationEntity.setSubstationTotalCost(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                transformerSubstationEntity.setCostHighVoltageOutdoor(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                transformerSubstationEntity.setCostIndoorEquipment(ShpAnalyticUtil.getDoubleVal(list.get(12).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                transformerSubstationEntity.setCostBuilding(ShpAnalyticUtil.getDoubleVal(list.get(13).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                transformerSubstationEntity.setYear(ShpAnalyticUtil.getIntegerVal(list.get(14).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                transformerSubstationEntity.setSite(ShpAnalyticUtil.getStringVal(list.get(15).toString(), "", false));
            }
            if(list.size()>16 && !PlatformObjectUtils.isEmpty(list.get(16))) {
                transformerSubstationEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(16).toString(), "", false));
            }
            if(list.size()>17 && !PlatformObjectUtils.isEmpty(list.get(17))) {
                transformerSubstationEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(17).toString(), "", false));
            }
            if(list.size()>18 && !PlatformObjectUtils.isEmpty(list.get(18))) {
                transformerSubstationEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(18).toString(), "", false));
            }
            if(list.size()>19 && !PlatformObjectUtils.isEmpty(list.get(19))) {
                transformerSubstationEntity.setExtends1(list.get(19).toString());
            }
            if(list.size()>20 && !PlatformObjectUtils.isEmpty(list.get(20))) {
                transformerSubstationEntity.setExtends2(list.get(20).toString());
            }
            if(list.size()>21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                transformerSubstationEntity.setExtends3(list.get(21).toString());
            }
            if(list.size()>22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                transformerSubstationEntity.setExtends4(list.get(22).toString());
            }
            if(list.size()>23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                transformerSubstationEntity.setExtends5(list.get(23).toString());
            }
            if(list.size()>24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                transformerSubstationEntity.setExtends6(list.get(24).toString());
            }
            if(list.size()>25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                transformerSubstationEntity.setExtends7(list.get(25).toString());
            }
            if(list.size()>26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                transformerSubstationEntity.setExtends8(list.get(26).toString());
            }
            if(list.size()>27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                transformerSubstationEntity.setExtends9(list.get(27).toString());
            }
            if(list.size()>28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                transformerSubstationEntity.setExtends10(list.get(28).toString());
            }
            arrayList.add(transformerSubstationEntity);
        }
        boolean res = false;
        for (TransformerSubstationEntity transformerSubstationEntity : arrayList) {
            res = vulnerabilityRepository.saveTransformerSubstation(transformerSubstationEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //道路Shp
    private Map<String, Object> uploadRoadShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<RoadEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 16) {
                return null;
            }
            RoadEntity roadEntity = new RoadEntity();
            roadEntity.setCreateUser(PlatformSessionContext.getUserID());
            roadEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            roadEntity.setDelFlag(YNEnum.N.toString());
            roadEntity.setAttachId(fileIds);
            roadEntity.setCrId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                roadEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                roadEntity.setId(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                roadEntity.setCrName(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                roadEntity.setCrClass(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                roadEntity.setCover(ShpAnalyticUtil.getStringVal(list.get(4).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                roadEntity.setRoadbedSoil(ShpAnalyticUtil.getStringVal(list.get(5).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                roadEntity.setSiteSoil(ShpAnalyticUtil.getStringVal(list.get(6).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                roadEntity.setFortification(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                roadEntity.setFoundationFail(ShpAnalyticUtil.getStringVal(list.get(8).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))){
                roadEntity.setRoadbedType(ShpAnalyticUtil.getStringVal(list.get(9).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                roadEntity.setRoadbedHigh(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                roadEntity.setCapacity(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                roadEntity.setPavement(ShpAnalyticUtil.getStringVal(list.get(12).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                roadEntity.setLength(ShpAnalyticUtil.getDoubleVal(list.get(13).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                roadEntity.setWidth(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                roadEntity.setNote(ShpAnalyticUtil.getStringVal(list.get(15).toString(), "", false));
            }
            if(list.size()>16 && !PlatformObjectUtils.isEmpty(list.get(16))) {
                roadEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(16).toString(), "", false));
            }
            if(list.size()>17 && !PlatformObjectUtils.isEmpty(list.get(17))) {
                roadEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(17).toString(), "", false));
            }
            if(list.size()>18 && !PlatformObjectUtils.isEmpty(list.get(18))) {
                roadEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(18).toString(), "", false));
            }
            if(list.size()>19 && !PlatformObjectUtils.isEmpty(list.get(19))) {
                roadEntity.setExtends1(list.get(19).toString());
            }
            if(list.size()>20 && !PlatformObjectUtils.isEmpty(list.get(20))) {
                roadEntity.setExtends2(list.get(20).toString());
            }
            if(list.size()>21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                roadEntity.setExtends3(list.get(21).toString());
            }
            if(list.size()>22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                roadEntity.setExtends4(list.get(22).toString());
            }
            if(list.size()>23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                roadEntity.setExtends5(list.get(23).toString());
            }
            if(list.size()>24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                roadEntity.setExtends6(list.get(24).toString());
            }
            if(list.size()>25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                roadEntity.setExtends7(list.get(25).toString());
            }
            if(list.size()>26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                roadEntity.setExtends8(list.get(26).toString());
            }
            if(list.size()>27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                roadEntity.setExtends9(list.get(27).toString());
            }
            if(list.size()>28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                roadEntity.setExtends10(list.get(28).toString());
            }
            arrayList.add(roadEntity);
        }
        boolean res = false;
        for (RoadEntity roadEntity : arrayList) {
            res = vulnerabilityRepository.saveRoad(roadEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //桥梁shp
    private Map<String, Object> uploadBridgeShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<BridgeEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 24) {
                return null;
            }
            BridgeEntity bridgeEntity = new BridgeEntity();
            bridgeEntity.setCreateUser(PlatformSessionContext.getUserID());
            bridgeEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            bridgeEntity.setDelFlag(YNEnum.N.toString());
            bridgeEntity.setAttachId(fileIds);
            bridgeEntity.setCbId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                bridgeEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                bridgeEntity.setId(list.get(1).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                bridgeEntity.setCbName(list.get(2).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                bridgeEntity.setLocation(list.get(3).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                bridgeEntity.setAcrossObject(list.get(4).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                bridgeEntity.setIntensity(list.get(5).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                bridgeEntity.setBuildYear(list.get(6).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                bridgeEntity.setStructure(list.get(7).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                bridgeEntity.setMaxSpan(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                bridgeEntity.setLength(ShpAnalyticUtil.getDoubleVal(list.get(9).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                bridgeEntity.setSiteSoil(ShpAnalyticUtil.getIntegerVal(list.get(10).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                bridgeEntity.setGrade(list.get(11).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                bridgeEntity.setFoundationFail(list.get(12).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                bridgeEntity.setSuperStructure(list.get(13).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                bridgeEntity.setBearing(list.get(14).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                bridgeEntity.setPierHeight(ShpAnalyticUtil.getDoubleVal(list.get(15).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(16))) {
                bridgeEntity.setPierMaterial(list.get(16).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(17))) {
                bridgeEntity.setBasement(list.get(17).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(18))) {
                bridgeEntity.setCapacity(ShpAnalyticUtil.getDoubleVal(list.get(18).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(19))) {
                bridgeEntity.setAbutmentMat(list.get(19).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(20))) {
                bridgeEntity.setAbutmentType(list.get(20).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(21))) {
                bridgeEntity.setExpansionJoint(ShpAnalyticUtil.getIntegerVal(list.get(21).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(22))) {
                bridgeEntity.setWidth(ShpAnalyticUtil.getDoubleVal(list.get(22).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(23))) {
                bridgeEntity.setNote(list.get(23).toString());
            }
            if(list.size()>24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                bridgeEntity.setProvince(list.get(24).toString());
            }
            if(list.size()>25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                bridgeEntity.setCity(list.get(25).toString());
            }
            if(list.size()>26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                bridgeEntity.setCounty(list.get(26).toString());
            }
            /*if(!PlatformObjectUtils.isEmpty(list.get(27))) {
                bridgeEntity.setLongitude(list.get(27).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(28))) {
                bridgeEntity.setLatitude(list.get(28).toString());
            }*/
            if(list.size()>27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                bridgeEntity.setExtends1(list.get(27).toString());
            }
            if(list.size()>28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                bridgeEntity.setExtends2(list.get(28).toString());
            }
            if(list.size()>29 && !PlatformObjectUtils.isEmpty(list.get(29))) {
                bridgeEntity.setExtends3(list.get(29).toString());
            }
            if(list.size()>30 && !PlatformObjectUtils.isEmpty(list.get(30))) {
                bridgeEntity.setExtends4(list.get(30).toString());
            }
            if(list.size()>31 && !PlatformObjectUtils.isEmpty(list.get(31))) {
                bridgeEntity.setExtends5(list.get(31).toString());
            }
            if(list.size()>32 && !PlatformObjectUtils.isEmpty(list.get(32))) {
                bridgeEntity.setExtends6(list.get(32).toString());
            }
            if(list.size()>33 && !PlatformObjectUtils.isEmpty(list.get(33))) {
                bridgeEntity.setExtends7(list.get(33).toString());
            }
            if(list.size()>34 && !PlatformObjectUtils.isEmpty(list.get(34))) {
                bridgeEntity.setExtends8(list.get(34).toString());
            }
            if(list.size()>35 && !PlatformObjectUtils.isEmpty(list.get(35))) {
                bridgeEntity.setExtends9(list.get(35).toString());
            }
            if(list.size()>36 && !PlatformObjectUtils.isEmpty(list.get(36))) {
                bridgeEntity.setExtends10(list.get(36).toString());
            }
            arrayList.add(bridgeEntity);
        }
        boolean res = false;
        for (BridgeEntity bridgeEntity : arrayList) {
            String geom = bridgeEntity.getGeom();
            if(!PlatformObjectUtils.isEmpty(geom)) {
                if(geom.contains("POINT")){
                    bridgeEntity.setFlag("0");
                    res = vulnerabilityRepository.saveBridgePoint(bridgeEntity);
                }else{
                    bridgeEntity.setFlag("1");
                    res = vulnerabilityRepository.saveBridgeLine(bridgeEntity);
                }
            }else {
                res = vulnerabilityRepository.saveBridgePoint(bridgeEntity);
            }
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //燃气-储气罐shp
    private Map<String, Object> uploadAirReceiverShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<AirReceiverEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 33) {
                return null;
            }
            AirReceiverEntity airReceiverEntity = new AirReceiverEntity();
            airReceiverEntity.setCreateUser(PlatformSessionContext.getUserID());
            airReceiverEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            airReceiverEntity.setDelFlag(YNEnum.N.toString());
            airReceiverEntity.setAttachId(fileIds);
            airReceiverEntity.setCarId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                airReceiverEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                airReceiverEntity.setId(list.get(1).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                airReceiverEntity.setCarName(list.get(2).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                airReceiverEntity.setLongitude(list.get(3).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                airReceiverEntity.setLatitude(list.get(4).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                airReceiverEntity.setStyle(list.get(5).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                airReceiverEntity.setCapacity(ShpAnalyticUtil.getDoubleVal(list.get(6).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                airReceiverEntity.setPressure(ShpAnalyticUtil.getDoubleVal(list.get(7).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                airReceiverEntity.setInnerDiameter(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                airReceiverEntity.setHeight(ShpAnalyticUtil.getDoubleVal(list.get(9).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                airReceiverEntity.setThickness(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                airReceiverEntity.setWeight(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                airReceiverEntity.setMaterial(list.get(12).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                airReceiverEntity.setRailLength(ShpAnalyticUtil.getDoubleVal(list.get(13).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                airReceiverEntity.setRailHeight(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                airReceiverEntity.setRailThickness(ShpAnalyticUtil.getDoubleVal(list.get(15).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(16))) {
                airReceiverEntity.setBaseType(list.get(16).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(17))) {
                airReceiverEntity.setMaterialType(list.get(17).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(18))) {
                airReceiverEntity.setElasticModulus(ShpAnalyticUtil.getDoubleVal(list.get(18).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(19))) {
                airReceiverEntity.setYieldStress(ShpAnalyticUtil.getDoubleVal(list.get(19).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(20))) {
                airReceiverEntity.setPermissibleStress(ShpAnalyticUtil.getDoubleVal(list.get(20).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(21))) {
                airReceiverEntity.setSite(ShpAnalyticUtil.getStringVal(list.get(21).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(22))) {
                airReceiverEntity.setLiquefaction6(ShpAnalyticUtil.getStringVal(list.get(22).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(23))) {
                airReceiverEntity.setLiquefaction7(ShpAnalyticUtil.getStringVal(list.get(23).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(24))) {
                airReceiverEntity.setLiquefaction8(ShpAnalyticUtil.getStringVal(list.get(24).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(25))) {
                airReceiverEntity.setLiquefaction9(ShpAnalyticUtil.getStringVal(list.get(25).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(26))) {
                airReceiverEntity.setSeismicSubsidence6(ShpAnalyticUtil.getStringVal(list.get(26).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(27))) {
                airReceiverEntity.setSeismicSubsidence7(ShpAnalyticUtil.getStringVal(list.get(27).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(28))) {
                airReceiverEntity.setSeismicSubsidence8(ShpAnalyticUtil.getStringVal(list.get(28).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(29))) {
                airReceiverEntity.setSeismicSubsidence9(ShpAnalyticUtil.getStringVal(list.get(29).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(30))) {
                airReceiverEntity.setYear(ShpAnalyticUtil.getIntegerVal(list.get(30).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(31))) {
                airReceiverEntity.setIntensity(ShpAnalyticUtil.getStringVal(list.get(31).toString(), "", false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(32))) {
                airReceiverEntity.setProvince(list.get(32).toString());
            }
            if(list.size()>33 && !PlatformObjectUtils.isEmpty(list.get(33))) {
                airReceiverEntity.setCity(list.get(33).toString());
            }
            if(list.size()>34 && !PlatformObjectUtils.isEmpty(list.get(34))) {
                airReceiverEntity.setCounty(list.get(34).toString());
            }
            if(list.size()>35 && !PlatformObjectUtils.isEmpty(list.get(35))) {
                airReceiverEntity.setExtends1(list.get(35).toString());
            }
            if(list.size()>36 && !PlatformObjectUtils.isEmpty(list.get(36))) {
                airReceiverEntity.setExtends2(list.get(36).toString());
            }
            if(list.size()>37 && !PlatformObjectUtils.isEmpty(list.get(37))) {
                airReceiverEntity.setExtends3(list.get(37).toString());
            }
            if(list.size()>38 && !PlatformObjectUtils.isEmpty(list.get(38))) {
                airReceiverEntity.setExtends4(list.get(38).toString());
            }
            if(list.size()>39 && !PlatformObjectUtils.isEmpty(list.get(39))) {
                airReceiverEntity.setExtends5(list.get(39).toString());
            }
            if(list.size()>40 && !PlatformObjectUtils.isEmpty(list.get(40))) {
                airReceiverEntity.setExtends6(list.get(40).toString());
            }
            if(list.size()>41 && !PlatformObjectUtils.isEmpty(list.get(41))) {
                airReceiverEntity.setExtends7(list.get(41).toString());
            }
            if(list.size()>42 && !PlatformObjectUtils.isEmpty(list.get(42))) {
                airReceiverEntity.setExtends8(list.get(42).toString());
            }
            if(list.size()>43 && !PlatformObjectUtils.isEmpty(list.get(43))) {
                airReceiverEntity.setExtends9(list.get(43).toString());
            }
            if(list.size()>44 && !PlatformObjectUtils.isEmpty(list.get(44))) {
                airReceiverEntity.setExtends10(list.get(44).toString());
            }
            arrayList.add(airReceiverEntity);
        }
        boolean res = false;
        for (AirReceiverEntity airReceiverEntity : arrayList) {
            res = vulnerabilityRepository.saveAirReceiver(airReceiverEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //水厂水池shp
    private Map<String, Object> uploadPoolShp(String fileIds) {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<PoolEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 37) {
                return null;
            }
            PoolEntity poolEntity = new PoolEntity();
            poolEntity.setCreateUser(PlatformSessionContext.getUserID());
            poolEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            poolEntity.setDelFlag(YNEnum.N.toString());
            poolEntity.setAttachId(fileIds);
            poolEntity.setCpId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                poolEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                poolEntity.setId(list.get(1).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                poolEntity.setStyle(list.get(2).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                poolEntity.setMaterial(list.get(3).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                poolEntity.setThickness(list.get(4).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                poolEntity.setShape(list.get(5).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                poolEntity.setRadius(list.get(6).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                poolEntity.setSlength(list.get(7).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                poolEntity.setLength(list.get(8).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                poolEntity.setCapacity(list.get(9).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                poolEntity.setDepth(list.get(10).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                poolEntity.setHeight(list.get(11).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                poolEntity.setJoint(list.get(12).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                poolEntity.setPresent(list.get(13).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                poolEntity.setQuality(list.get(14).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                poolEntity.setSurfaceShape1(list.get(15).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(16))) {
                poolEntity.setSurfaceShape2(list.get(16).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(17))) {
                poolEntity.setDiameter1(list.get(17).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(18))) {
                poolEntity.setDiameter2(list.get(18).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(19))) {
                poolEntity.setStrengthGrade(list.get(19).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(20))) {
                poolEntity.setKinds1(list.get(20).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(21))) {
                poolEntity.setKinds2(list.get(21).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(22))) {
                poolEntity.setThicknessLayer1(list.get(22).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(23))) {
                poolEntity.setThicknessLayer2(list.get(23).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(24))) {
                poolEntity.setInnerReinforcement(list.get(24).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(25))) {
                poolEntity.setOutReinforcement(list.get(25).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(26))) {
                poolEntity.setIntensity(list.get(26).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(27))) {
                poolEntity.setSite(list.get(27).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(28))) {
                poolEntity.setYear(list.get(28).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(29))) {
                poolEntity.setLiquefaction6(list.get(29).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(30))) {
                poolEntity.setLiquefaction7(list.get(30).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(31))) {
                poolEntity.setLiquefaction8(list.get(31).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(32))) {
                poolEntity.setLiquefaction9(list.get(32).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(33))) {
                poolEntity.setLandform6(list.get(33).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(34))) {
                poolEntity.setLandform7(list.get(34).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(35))) {
                poolEntity.setLandform8(list.get(35).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(36))) {
                poolEntity.setLandform9(list.get(36).toString());
            }
            if(list.size()>37 && !PlatformObjectUtils.isEmpty(list.get(37))) {
                poolEntity.setProvince(list.get(37).toString());
            }
            if(list.size()>38 && !PlatformObjectUtils.isEmpty(list.get(38))) {
                poolEntity.setCity(list.get(38).toString());
            }
            if(list.size()>39 && !PlatformObjectUtils.isEmpty(list.get(39))) {
                poolEntity.setCounty(list.get(39).toString());
            }
            /*if(list.size()>40 && !PlatformObjectUtils.isEmpty(list.get(40))) {
                poolEntity.setLongitude(list.get(40).toString());
            }
            if(list.size()>41 && !PlatformObjectUtils.isEmpty(list.get(41))) {
                poolEntity.setLatitude(list.get(41).toString());
            }*/
            if(list.size()>40 && !PlatformObjectUtils.isEmpty(list.get(40))) {
                poolEntity.setExtends1(list.get(40).toString());
            }
            if(list.size()>41 && !PlatformObjectUtils.isEmpty(list.get(41))) {
                poolEntity.setExtends2(list.get(41).toString());
            }
            if(list.size()>42 && !PlatformObjectUtils.isEmpty(list.get(42))) {
                poolEntity.setExtends3(list.get(42).toString());
            }
            if(list.size()>43 && !PlatformObjectUtils.isEmpty(list.get(43))) {
                poolEntity.setExtends4(list.get(43).toString());
            }
            if(list.size()>44 && !PlatformObjectUtils.isEmpty(list.get(44))) {
                poolEntity.setExtends5(list.get(44).toString());
            }
            if(list.size()>45 && !PlatformObjectUtils.isEmpty(list.get(45))) {
                poolEntity.setExtends6(list.get(45).toString());
            }
            if(list.size()>46 && !PlatformObjectUtils.isEmpty(list.get(46))) {
                poolEntity.setExtends7(list.get(46).toString());
            }
            if(list.size()>47 && !PlatformObjectUtils.isEmpty(list.get(47))) {
                poolEntity.setExtends8(list.get(47).toString());
            }
            if(list.size()>48 && !PlatformObjectUtils.isEmpty(list.get(48))) {
                poolEntity.setExtends9(list.get(48).toString());
            }
            if(list.size()>49 && !PlatformObjectUtils.isEmpty(list.get(49))) {
                poolEntity.setExtends10(list.get(49).toString());
            }
            arrayList.add(poolEntity);
        }
        boolean res = false;
        for (PoolEntity poolEntity : arrayList) {
            res = vulnerabilityRepository.savePool(poolEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //水厂泵房shp
    private Map<String, Object> uploadWaterworksShp(String fileIds) throws ShpFieldException, com.css.fxfzfxqh.exceptions.ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<WaterWorksEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 22) {
                return null;
            }
            WaterWorksEntity waterWorksEntity = new WaterWorksEntity();
            waterWorksEntity.setCreateUser(PlatformSessionContext.getUserID());
            waterWorksEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            waterWorksEntity.setDelFlag(YNEnum.N.toString());
            waterWorksEntity.setAttachId(fileIds);
            waterWorksEntity.setCwId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                waterWorksEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                waterWorksEntity.setCwName(list.get(1).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                waterWorksEntity.setLongitude(list.get(2).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                waterWorksEntity.setLatitude(list.get(3).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                waterWorksEntity.setId(list.get(4).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                waterWorksEntity.setBuildingName(list.get(5).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                waterWorksEntity.setType(ShpAnalyticUtil.getStringVal(list.get(6).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                waterWorksEntity.setFloors(Integer.valueOf(list.get(7).toString()));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                waterWorksEntity.setArea(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                waterWorksEntity.setMaterial(list.get(9).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                waterWorksEntity.setMaterialType(list.get(10).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                waterWorksEntity.setSite(ShpAnalyticUtil.getStringVal(list.get(11).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                waterWorksEntity.setLiquefaction6(ShpAnalyticUtil.getStringVal(list.get(12).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                waterWorksEntity.setLiquefaction7(ShpAnalyticUtil.getStringVal(list.get(13).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                waterWorksEntity.setLiquefaction8(ShpAnalyticUtil.getStringVal(list.get(14).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                waterWorksEntity.setLiquefaction9(ShpAnalyticUtil.getStringVal(list.get(15).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(16))) {
                waterWorksEntity.setSeismicSubsidence6(ShpAnalyticUtil.getStringVal(list.get(16).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(17))) {
                waterWorksEntity.setSeismicSubsidence7(ShpAnalyticUtil.getStringVal(list.get(17).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(18))) {
                waterWorksEntity.setSeismicSubsidence8(ShpAnalyticUtil.getStringVal(list.get(18).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(19))) {
                waterWorksEntity.setSeismicSubsidence9(ShpAnalyticUtil.getStringVal(list.get(19).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(20))) {
                waterWorksEntity.setYear(ShpAnalyticUtil.getIntegerVal(list.get(20).toString(),"",false));
            }
            if(!PlatformObjectUtils.isEmpty(list.get(21))) {
                waterWorksEntity.setIntensity(ShpAnalyticUtil.getStringVal(list.get(21).toString(),"",false));
            }
            if(list.size()>22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                waterWorksEntity.setProvince(list.get(22).toString());
            }
            if(list.size()>23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                waterWorksEntity.setCity(list.get(23).toString());
            }
            if(list.size()>24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                waterWorksEntity.setCounty(list.get(24).toString());
            }
            if(list.size()>25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                waterWorksEntity.setExtends1(list.get(25).toString());
            }
            if(list.size()>26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                waterWorksEntity.setExtends2(list.get(26).toString());
            }
            if(list.size()>27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                waterWorksEntity.setExtends3(list.get(27).toString());
            }
            if(list.size()>28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                waterWorksEntity.setExtends4(list.get(28).toString());
            }
            if(list.size()>29 && !PlatformObjectUtils.isEmpty(list.get(29))) {
                waterWorksEntity.setExtends5(list.get(29).toString());
            }
            if(list.size()>30 && !PlatformObjectUtils.isEmpty(list.get(30))) {
                waterWorksEntity.setExtends6(list.get(30).toString());
            }
            if(list.size()>31 && !PlatformObjectUtils.isEmpty(list.get(31))) {
                waterWorksEntity.setExtends7(list.get(31).toString());
            }
            if(list.size()>32 && !PlatformObjectUtils.isEmpty(list.get(32))) {
                waterWorksEntity.setExtends8(list.get(32).toString());
            }
            if(list.size()>33 && !PlatformObjectUtils.isEmpty(list.get(33))) {
                waterWorksEntity.setExtends9(list.get(33).toString());
            }
            if(list.size()>34 && !PlatformObjectUtils.isEmpty(list.get(34))) {
                waterWorksEntity.setExtends10(list.get(34).toString());
            }
            arrayList.add(waterWorksEntity);
        }
        boolean res = false;
        for (WaterWorksEntity waterWorksEntity : arrayList) {
            res = vulnerabilityRepository.saveWaterWork(waterWorksEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }

    //导入地下管网shp文件
    private Map<String, Object> uploadDxPipeNetworkShp(String fileIds) {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res",false);
            map.put("mess",shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<DxPipeNetworkEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 33) {
                return null;
            }
            DxPipeNetworkEntity dxPipeNetworkEntity = new DxPipeNetworkEntity();
            dxPipeNetworkEntity.setCreateUser(PlatformSessionContext.getUserID());
            dxPipeNetworkEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            dxPipeNetworkEntity.setDelFlag(YNEnum.N.toString());
            dxPipeNetworkEntity.setAttachId(fileIds);
            dxPipeNetworkEntity.setCdpnId(UUIDGenerator.getUUID());
            if(!PlatformObjectUtils.isEmpty(list.get(0))) {
                dxPipeNetworkEntity.setGeom(list.get(0).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(1))) {
                dxPipeNetworkEntity.setId(list.get(1).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(2))) {
                dxPipeNetworkEntity.setCdpnName(list.get(2).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(3))) {
                dxPipeNetworkEntity.setCdpnClass(list.get(3).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(4))) {
                dxPipeNetworkEntity.setStartId(list.get(4).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(5))) {
                dxPipeNetworkEntity.setEndId(list.get(5).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(6))) {
                dxPipeNetworkEntity.setLongitude(list.get(6).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(7))) {
                dxPipeNetworkEntity.setLatitude(list.get(7).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(8))) {
                dxPipeNetworkEntity.setLength(list.get(8).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(9))) {
                dxPipeNetworkEntity.setMaterial(list.get(9).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(10))) {
                dxPipeNetworkEntity.setMaterialType(list.get(10).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(11))) {
                dxPipeNetworkEntity.setElasticModulus(list.get(11).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(12))) {
                dxPipeNetworkEntity.setYieldLimitStress(list.get(12).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(13))) {
                dxPipeNetworkEntity.setStrengthLimitStress(list.get(13).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(14))) {
                dxPipeNetworkEntity.setPermissibleStrain(list.get(14).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(15))) {
                dxPipeNetworkEntity.setDiameter(list.get(15).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(16))) {
                dxPipeNetworkEntity.setThickness(list.get(16).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(17))) {
                dxPipeNetworkEntity.setPressure(list.get(17).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(18))) {
                dxPipeNetworkEntity.setJoint(list.get(18).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(19))) {
                dxPipeNetworkEntity.setJointy(list.get(19).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(20))) {
                dxPipeNetworkEntity.setAllowableElongation(list.get(20).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(21))) {
                dxPipeNetworkEntity.setSite(list.get(21).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(22))) {
                dxPipeNetworkEntity.setLiquefaction6(list.get(22).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(23))) {
                dxPipeNetworkEntity.setLiquefaction7(list.get(23).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(24))) {
                dxPipeNetworkEntity.setLiquefaction8(list.get(24).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(25))) {
                dxPipeNetworkEntity.setLiquefaction9(list.get(25).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(26))) {
                dxPipeNetworkEntity.setSeismicSubsidence6(list.get(26).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(27))) {
                dxPipeNetworkEntity.setSeismicSubsidence7(list.get(27).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(28))) {
                dxPipeNetworkEntity.setSeismicSubsidence8(list.get(28).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(29))) {
                dxPipeNetworkEntity.setSeismicSubsidence9(list.get(29).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(30))) {
                dxPipeNetworkEntity.setDepth(list.get(30).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(31))) {
                dxPipeNetworkEntity.setYear(list.get(31).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(32))) {
                dxPipeNetworkEntity.setIntensity(list.get(32).toString());
            }
            if(list.size()>33 && !PlatformObjectUtils.isEmpty(list.get(33))) {
                dxPipeNetworkEntity.setProvince(list.get(33).toString());
            }
            if(list.size()>34 && !PlatformObjectUtils.isEmpty(list.get(34))) {
                dxPipeNetworkEntity.setCity(list.get(34).toString());
            }
            if(list.size()>35 && !PlatformObjectUtils.isEmpty(list.get(35))) {
                dxPipeNetworkEntity.setCounty(list.get(35).toString());
            }
            if(list.size()>36 && !PlatformObjectUtils.isEmpty(list.get(36))) {
                dxPipeNetworkEntity.setExtends1(list.get(36).toString());
            }
            if(list.size()>37 && !PlatformObjectUtils.isEmpty(list.get(37))) {
                dxPipeNetworkEntity.setExtends2(list.get(37).toString());
            }
            if(list.size()>38 && !PlatformObjectUtils.isEmpty(list.get(38))) {
                dxPipeNetworkEntity.setExtends3(list.get(38).toString());
            }
            if(list.size()>39 && !PlatformObjectUtils.isEmpty(list.get(39))) {
                dxPipeNetworkEntity.setExtends4(list.get(39).toString());
            }
            if(list.size()>40 && !PlatformObjectUtils.isEmpty(list.get(40))) {
                dxPipeNetworkEntity.setExtends5(list.get(40).toString());
            }
            if(list.size()>41 && !PlatformObjectUtils.isEmpty(list.get(41))) {
                dxPipeNetworkEntity.setExtends6(list.get(41).toString());
            }
            if(list.size()>42 && !PlatformObjectUtils.isEmpty(list.get(42))) {
                dxPipeNetworkEntity.setExtends7(list.get(42).toString());
            }
            if(list.size()>43 && !PlatformObjectUtils.isEmpty(list.get(43))) {
                dxPipeNetworkEntity.setExtends8(list.get(43).toString());
            }
            if(list.size()>44 && !PlatformObjectUtils.isEmpty(list.get(44))) {
                dxPipeNetworkEntity.setExtends9(list.get(44).toString());
            }
            if(list.size()>45 && !PlatformObjectUtils.isEmpty(list.get(45))) {
                dxPipeNetworkEntity.setExtends10(list.get(45).toString());
            }
            arrayList.add(dxPipeNetworkEntity);
        }
        boolean res = false;
        for (DxPipeNetworkEntity dxPipeNetworkEntity : arrayList) {
            res = vulnerabilityRepository.saveDxPipeNetwork(dxPipeNetworkEntity);
        }
        if(res){
            for(String attachId : fileIds.split(",")){
                res = saveLifelineAttachmentRecord(attachId,PlatformSessionContext.getUserID());
            }
        }
        map.put("res",res);
        return map;
    }


    @Override
    public Map<String, Object> page(QueryParamsVo queryParamsVo, int curPage, int pageSize) {
        return vulnerabilityRepository.page(queryParamsVo,curPage,pageSize);
    }

    @Override
    public Map findById(String id,String type) {
        return vulnerabilityRepository.findById(id,type);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Boolean update(Map<String, Object> map) {
        return vulnerabilityRepository.update(map);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Boolean delete(Map<String,Object> map) {
        Map<String,Object> map1 = (Map<String, Object>) map.get("map");
        String ids = (String) map1.get("ids");
        String type = (String) map.get("type");
        boolean res = false;
        for(String id : ids.split(",")){
            res = vulnerabilityRepository.delete(id, type);
        }
        return res;
    }

    @Override
    public Map bridgeFindById(String id, String flag) {
        return vulnerabilityRepository.bridgeFindById(id, flag);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Boolean bridgeDelete(Map<String, Object> map) {
        Map<String,Object> map1 = (Map<String, Object>) map.get("map");
        String ids = (String) map1.get("ids");
        String flag = (String) map1.get("flag");
        boolean res = false;
        for(String id : ids.split(",")){
            res = vulnerabilityRepository.bridgeDelete(id, flag);
        }
        return res;
    }

    @Override
    public void importExcel(MultipartFile file) throws Exception {
        // 导入的参数信息
        ImportParams params = new ImportParams();
        params.setTitleRows(1);
        params.setHeadRows(2);
        params.setNeedVerify(true);
        params.setVerifyHandler(vulnerabilityExcelVerify);


        ExcelImportResult<VulnerabilityImportVo> result = ExcelImportUtil.importExcelMore(file.getInputStream(), VulnerabilityImportVo.class, params);
        List<VulnerabilityImportVo> failList = result.getFailList();
        if (PlatformObjectUtils.isNotEmpty(failList)) {
            StringBuilder errorMsg = new StringBuilder("<font size='5px' color='red'>导入失败：</font>");
            for (VulnerabilityImportVo item : failList) {
                errorMsg.append("<font size='4px' ><br>").append("第").append(item.getRowNum() + 1).append("行： ").append(item.getErrorMsg()).append("</font>");
            }
            throw new RuntimeException(errorMsg.toString());
        }
        List<VulnerabilityImportVo> resultData = result.getList();//解析excel


        List<VulnerabilityImportVo> filteredData = new LinkedList<>();
        List<String> pgcdList = getDataByDictCode("pgcd");
        pgcdList.remove("基本完好");


        //按照经纬度分组
        Map<String, List<VulnerabilityImportVo>> groupedData = resultData.stream()
                .collect(Collectors.groupingBy(vo -> vo.getLongitude() + "_" + vo.getLatitude()));
        groupedData.forEach((key, value) -> {
            String area=vulnerabilityRepository.getAreaCodeByLonAndLat(key.split("_")[0],key.split("_")[1]);
            String vulnerabilityCode = getVulnerabilityCode(area);
            // 收集每条数据中的damage值到一个List<String>中
            List<String> damageList = value.stream()
                    .map(VulnerabilityImportVo::getDamage)
                    .collect(Collectors.toList());
            if (damageList.size() == 4 && new HashSet<>(damageList).containsAll(pgcdList)) {
                value.forEach( item -> {
                    item.setVulnerabilityCode(vulnerabilityCode);
                    String damage = dictService.getKeyByDictCodeAndValue("pgcd", item.getDamage());
                    item.setDamage(damage);
                });
                //保证破坏程度顺序
                Comparator<VulnerabilityImportVo> comparator = Comparator.comparing(VulnerabilityImportVo::getDamage);
                // 调用sort方法对列表进行排序
                Collections.sort(value, comparator);
                filteredData.addAll(value);

            } else {
                throw new RuntimeException("经纬度：" + value.get(0).getLongitude() + "   " + value.get(0).getLatitude() + "破坏程度必须包含轻微破坏、中等破坏、严重破坏、倒塌");
            }
        });


        List<BuildingIndividualVulnerability> list = new ArrayList<>();
        List<String> repeatIdList = new ArrayList<>();
        if (!CollectionUtils.isEmpty(filteredData)) {
            String userId = PlatformSessionContext.getUserID();
            for (VulnerabilityImportVo item : filteredData) {
                //根据经纬度及破坏程度查询重复数据
                String damage = item.getDamage();
                List<String> idList = vulnerabilityRepository.
                        getVulnerabilityByCondition(item.getLongitude(), item.getLatitude(), damage);
                repeatIdList.addAll(idList);
                BuildingIndividualVulnerability vulnerability = new BuildingIndividualVulnerability();
                BeanUtils.copyProperties(item, vulnerability);
                vulnerability.setId(UUIDGenerator.getUUID());
                vulnerability.setCreateUser(userId);
                vulnerability.setCreateTime(new Date());
                vulnerability.setDamage(damage);

                list.add(vulnerability);
            }
        }
        if(repeatIdList.size()>0){
            vulnerabilityRepository.batchDelete(repeatIdList);
        }

        vulnerabilityRepository.batchSave(list);

    }

    /**
     * 生成易损性编号
     *
     * <p>易损性编号规则：区县编号+6位有序数如000001、000002
     *
     * @param areaCode 区县code
     * @return
     */
    public synchronized String getVulnerabilityCode(@NotNull String areaCode) {
        ValueOperations<String, String> valueOperations = redisTemplate.opsForValue();
        String vulnerabilityCode = valueOperations.get(YSXSJ_CODE_SERIAL_NUMBER_KEY+areaCode);
        if (StringUtils.isBlank(vulnerabilityCode)) {
            vulnerabilityCode = "000001";
        } else {
            StringBuilder stringBuilder = new StringBuilder();
            String t = String.valueOf(Integer.parseInt(vulnerabilityCode) + 1);
            for (int i = t.length(); i < 6; i++) {
                stringBuilder.append("0");
            }
            vulnerabilityCode = stringBuilder.append(t).toString();
        }
        redisTemplate
                .opsForValue()
                .set(YSXSJ_CODE_SERIAL_NUMBER_KEY+areaCode, vulnerabilityCode);
        return  areaCode + vulnerabilityCode;
    }

    private List<String> getDataByDictCode(String code){
        List<DictItemEntity> validDictItemsByDictCode = dictService.getValidDictItemsByDictCode(code);
        List<String> list = new ArrayList<>();
        for(DictItemEntity dictItemEntity: validDictItemsByDictCode){
            String dictItemName = dictItemEntity.getDictItemName();
            list.add(dictItemName);
        }
        return list;
    }

    @Override
    public Map<String, Object> getPage(int curPage, int pageSize) {
        Map<String,Object> page=vulnerabilityRepository.getPage(curPage, pageSize);
        return page;
    }

    @Override
    public List<BuildingIndividualVulnerability> matrixFindByCode(String code) {
        return vulnerabilityRepository.matrixFindByCode(code);
    }

    @Override
    public Boolean matrixUpdate(List<BuildingIndividualVulnerability> list) {
        list.forEach(item->{
            item.setUpdateTime(new Date());
            item.setUpdateUser(PlatformSessionContext.getUserID());
        });
        return vulnerabilityRepository.matrixUpdate(list);
    }

    @Override
    public MatrixConvertCurveVo matrixConvertCurve(BuildingIndividualVulnerability vulnerability) {


        MatrixConvertCurveVo matrixConvertCurveVo = new MatrixConvertCurveVo();
        String mr = vulnerability.getMr().toString();
        String br = vulnerability.getBr().toString();

        matrixConvertCurveVo.setCoordinate1(getFuntionValue(mr, br, PgaConstants.ZERO_ZERO_FIVE));
        matrixConvertCurveVo.setCoordinate2(getFuntionValue(mr, br, PgaConstants.ZERO_ONE));
        matrixConvertCurveVo.setCoordinate3(getFuntionValue(mr, br, PgaConstants.ZERO_TWO));
        matrixConvertCurveVo.setCoordinate4(getFuntionValue(mr, br, PgaConstants.ZERO_FOUR));
        matrixConvertCurveVo.setCoordinate5(getFuntionValue(mr, br, PgaConstants.ZERO_EIGHT));
        matrixConvertCurveVo.setCoordinate6(getFuntionValue(mr, br, PgaConstants.ZERO_NINE));
        return matrixConvertCurveVo;
    }
    public static BigDecimal getFuntionValue(String mr, String br, String im){


        double value = (Math.log(Double.parseDouble(im)) - Math.log(Double.parseDouble(mr))) / Double.parseDouble(br);
        return selfCaculate(BigDecimal.valueOf(value).setScale(4,BigDecimal.ROUND_HALF_UP));
    }

    private static BigDecimal selfCaculate(BigDecimal u) {
        BigDecimal ret = BigDecimal.valueOf(0);
        if (u.compareTo(BigDecimal.valueOf(-3.89)) < 0) {
            return new BigDecimal(0);
        } else if (u.compareTo(BigDecimal.valueOf(3.89)) > 0) {
            return new BigDecimal(1);
        }
        BigDecimal temp = BigDecimal.valueOf(-3.89);
        while (temp.compareTo(u) < 1) {
            ret = ret.add(BigDecimal.valueOf(0.0001).multiply(fx(temp)));
            temp = temp.add(BigDecimal.valueOf(0.0001));
        }
        return ret;
    }

    private static BigDecimal fx(BigDecimal x) {
        double a = 1.0 / Math.sqrt(Math.PI * 2);
        a = a * Math.pow(Math.E, -0.5 * Math.pow(Double.parseDouble(x.toString()), 2));
        return BigDecimal.valueOf(a);
    }

    /**
     * 统一文件名
     *
     * @param fileIds
     */
    public void uniformFileName(String fileIds) {
        String[] idList = fileIds.split(",");
        AttachmentInfoEntity attachRoot = attachmentInfoService.getAttach(idList[0]);
        String attachRootPath = attachRoot.getAttachPath();
        String filePathCurrTime = getFilePathCurrTime(attachRootPath);
        for (int i = 1; i < idList.length; i++) {
            AttachmentInfoEntity attach = attachmentInfoService.getAttach(idList[i]);
            if (getFilePathCurrTime(attach.getAttachPath()).equals(filePathCurrTime)) {
                continue;
            }
            String attachPath = attach.getAttachPath();
            String fileDiskPath = localDir + attachPath;
            FileUtil.rename(new File(fileDiskPath), getNonSuffixFileName(attach.getAttachName()) + "_" + filePathCurrTime + "." + FileUtil.getSuffix(attach.getAttachName()), true);
            String[] s = attachPath.split("_");
            attach.setAttachPath(s[0] + "_" + filePathCurrTime + "." + FileUtil.getSuffix(attach.getAttachName()));
            attachmentInfoService.update(attach);
        }
    }

    public ParsingResult getShpData(String fileIds) {
        //.prj结尾用来校验是否为2000坐标系
        String prj = "";
        //.cpg文件用来获得编码格式,例如utf-8
        String cpg = "";
        //.shp文件用来获得数据
        String shp = "";
        //根据id获取真实地址
        String[] split = fileIds.split(",");
        for (String id : split) {
            //根据id和文件名获取真实的放在磁盘上的文件
            AttachmentInfoEntity attachmentInfoEntity = attachmentInfoService.getAttach(id);
            String attachPath = attachmentInfoEntity.getAttachPath();
            String substring = attachPath.substring(attachPath.length() - 4);
            if (substring.equals(".prj")) {
                prj = localDir + File.separator + attachPath;
            } else if (substring.equals(".cpg")) {
                cpg = localDir + File.separator + attachPath;
            } else if (substring.equals(".shp")) {
                shp = localDir + File.separator + attachPath;
            }
        }
        return ShpAnalyticUtil.analytic(prj, cpg, shp);
    }

    private String getFilePathCurrTime(String filePath) {
        return filePath.split("_")[1].replaceAll("." + FileUtil.getSuffix(filePath.split("_")[1]), "");
    }

    private String getNonSuffixFileName(String fileName) {
        return fileName.replaceAll("." + FileUtil.getSuffix(fileName), "");
    }




}
